Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original example runs fine for me, what error did you see?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message: configuration error: package name must be specified
$ go version go version go1.19.3 darwin/amd64 $ go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest $ ls specs.yaml $ oapi-codegen specs.yaml configuration error: package name must be specified $ oapi-codegen -package packagename specs.yaml >/dev/null $a minimal specs.yaml has been attached: specs.txt
let me know if you need any further info
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the example, I had an older version and looks like the configuration changes introduced a regression so there's no default.
I've done a quick PR #873 which fixes this regression as well as improving it for named files, which is the common case. Would be great if you could test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks.
Could you send me something about how to test it? (not sure how to install a package from a different branch/repo than the default one, havent done before)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed if you used openapi 3 right command will be:
oapi-codegen -package api -o api/name.go api/name.yaml
Otherwise I cathed: Only one OpenAPI 3.0 spec file is accepted and it must be the last CLI argument
Spent one hour for solved all problem:(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if it was updated to use cobra as that has very powerful validation, that is super simple to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following should be general gist: