fixed template rendering with current version of go-swagger #40
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.
Recently I started getting these errors when I try to compile code generated with stratoscale/swagger:
A breaking change was made to go-openapi/errors in the summer of 2020:
In order for go-swagger-generated code to compile properly, you need to use at least version v0.24.0 of go-swagger:
Unfortunately, stratoscale/swagger is not compatible with the latest versions of go-swagger; the template fails to render with this error:
I fixed this by removing the
{{ if .WithContext }}
conditional from theOperations
block inserver/configureapi.gotmpl
. The template renders and the resulting code is compatible with the latest go-openapi/errors.I'm not clear on the implications of removing the
WithContext
conditional. It's possible that other changes need to be made to the templates to compensate for the removal of this block. I'll leave that up to the experts. But I'd greatly appreciate a 1.0.28 release with a fix for this incompatibility.