Skip to content

Commit c322bf8

Browse files
reversearrowdaveshanley
authored andcommitted
add comment on the main func
1 parent df552db commit c322bf8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cmd/validate/main.go

+20
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@ var (
6666
If not specified, the default libopenapi regex engine is "re2"".`)
6767
)
6868

69+
// main is the entry point for validating an OpenAPI Specification (OAS) document.
70+
// It uses the libopenapi-validator library to check if the provided OAS document
71+
// conforms to the OpenAPI specification.
72+
//
73+
// This tool accepts a single input file (YAML or JSON) and provides an optional
74+
// `--regexengine` flag to customize the regex engine used during validation.
75+
// This is useful for cases where the spec uses regex patterns that require engines
76+
// like ECMAScript or RE2.
77+
//
78+
// Supported regex options include:
79+
// - Engines: re2 (default), ecmascript
80+
// - Flags: ignorecase, multiline, explicitcapture, compiled, singleline,
81+
// ignorepatternwhitespace, righttoleft, debug, unicode
82+
//
83+
// Example usage:
84+
//
85+
// go run main.go --regexengine=ecmascript ./my-api-spec.yaml
86+
//
87+
// If validation passes, the tool logs a success message.
88+
// If the document is invalid or there is a processing error, it logs details and exits non-zero.
6989
func main() {
7090
flag.Usage = func() {
7191
fmt.Fprintf(os.Stderr, `Usage: validate [OPTIONS] <file>

0 commit comments

Comments
 (0)