Skip to content

fixes an error message containing a nil err object#1048

Merged
deepmap-marcinr merged 1 commit intooapi-codegen:masterfrom
mwasilew2:issue_1047
May 13, 2023
Merged

fixes an error message containing a nil err object#1048
deepmap-marcinr merged 1 commit intooapi-codegen:masterfrom
mwasilew2:issue_1047

Conversation

@mwasilew2
Copy link
Copy Markdown
Contributor

Fixes: #1047

Error message before the patch:

$ oapi-codegen -config codegen.cfg.yml battleship-oapi.yaml
error parsing configuration style as old version or new version: <nil>
[1]    106688 exit 1     oapi-codegen -config codegen.cfg.yml battleship-oapi.yaml

and after the patch:

$ oapi-codegen -config codegen.cfg.yml battleship-oapi.yaml
error parsing configuration style as old version or new version

error when parsing using old config version:
yaml: unmarshal errors:
  line 3: cannot unmarshal !!map into []string

error when parsing using new config version:
yaml: unmarshal errors:
  line 5: field server not found in type codegen.GenerateOptions
[1]    109954 exit 1     oapi-codegen -config codegen.cfg.yml battleship-oapi.yaml

This fix is just a quick hack to show the problem. If it's not good enough for merging please point me in the right direction and I'm happy to make it more consistent with the rest of the codebase.

Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
@deepmap-marcinr deepmap-marcinr merged commit bf56ed2 into oapi-codegen:master May 13, 2023
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
adrianpk added a commit to foorester/oapi-codegen that referenced this pull request May 31, 2024
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
danicc097 pushed a commit to danicc097/oapi-codegen that referenced this pull request Aug 31, 2024
Signed-off-by: Michal Wasilewski <mwasilewski@gmx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix a config parsing error message

2 participants