Summary
When the configuration file provided in the -config CLI parameter doesn't parse correctly as either a "new" style or "old" style config, the binary returns a nil error to the user instead of the more helpful errors from yaml.UnmarshalStrict().
(Edit: Looks like a duplicate of issue #979)
Behavior
$ oapi-codegen -config config.yaml openapi.json
error parsing configuration style as old version or new version: <nil>
To reproduce the error, use this (broken) config YAML:
package: nwsapi
generate:
models: true
embedded-spec: true
client: true
compatability:
always-prefix-enum-values: true
Version Information
% oapi-codegen -version
github.com/deepmap/oapi-codegen/cmd/oapi-codegen
v1.12.4
Explanation
The value of err where this error is returned is always nil because it has just passed the gate logic here.
Suggested Change
Return the current value of newErr, or both newErr and oldErr instead. This allows the user to get more information about why their provided config isn't valid from the YAML parser.
Summary
When the configuration file provided in the
-configCLI parameter doesn't parse correctly as either a "new" style or "old" style config, the binary returns anilerror to the user instead of the more helpful errors fromyaml.UnmarshalStrict().(Edit: Looks like a duplicate of issue #979)
Behavior
To reproduce the error, use this (broken) config YAML:
Version Information
Explanation
The value of
errwhere this error is returned is alwaysnilbecause it has just passed the gate logic here.Suggested Change
Return the current value of
newErr, or bothnewErrandoldErrinstead. This allows the user to get more information about why their provided config isn't valid from the YAML parser.