oapi-codegen
oapi-codegen copied to clipboard
Change to template overrides in v1.9.1 broke our build pipeline
This change in v1.9.1 broke our build pipeline, as we are using template overrides which now suddenly are expected to be placed in a different location: https://github.com/deepmap/oapi-codegen/compare/v1.9.0...v1.9.1#diff-adba78e29f6e65748fe711bfeb66b4a82a9b59226b5d2c0d8c891e2c5a7d48f1
In our particular case, we have a chi-middleware.tmpl
file in a dir (named codegen
in our case) we point at using the -templates
flag. Simply moving the chi-middleware.tmpl
into chi/chi-middleware.tmpl
within that dir also doesn't seem to work, and instead produced this error:
error loading template overrides: read ../../../codegen/chi: is a directory
exit status 1
Very dissapointed in this breaking change considering it was only a patch version increase. Changing back to v1.9.0
solved it for us. I guess we can blame ourselves for using
//go:generate go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
since using @latest
made it ignore our go.sum
. That one is on us 🙂
I have same problem with this version.
Overriding not working because actual template name chi/chi-middleware.tmpl
but custom template name chi-middleware.tmpl
and they are never matching. Besides that, when you tring to put that file chi
subfolder, it fails.
Confirmed the same with 1.9.1 and Up Voting for a fix.
Also confirmed that using go install github.com/deepmap/oapi-codegen/cmd/[email protected]
fixed the issue.
Would like to see sub-directories evaluated as consistently in path, as the other templates. The name chi/chi-...tmpl
stutters, but it's confusing that no subdirectory is needed when the ReadMe talks about naming the templates identically.
I confirm the issue. Vote for the fix, especially since the corresponding PR is already exists - Recursively load subdirectory template files
Argh, sorry folks! Sorry we've missed this issue until now, as well as introduced the breaking change - I assume it'd still be good to have an option to retain the existing behaviour?