feat: Add struct tag query for binding query parameters in echo framework
related: https://github.com/deepmap/oapi-codegen/issues/1009
in the Echo framework, query binding is performed using the struct tag query, as detailed in Echo's documentation on struct tag binding (https://echo.labstack.com/guide/binding/#struct-tag-binding). If you are using oapi-codegen to generate an Echo server, there isn't an issue because the BindQueryParameter method handles the binding. But if oapi-codegen is only used to generate models, you'll encounter a problem since Echo won't bind query parameters to a field that lacks the query struct tag.
Therefore, I suggest adding the query struct tag. The modified code would look like this:
type FindPetsParams struct {
Tags *[]string `form:"tags,omitempty" json:"tags,omitempty" query:"tags,omitempty"`
Limit *int32 `form:"limit,omitempty" json:"limit,omitempty" query:"limit,omitempty"`
}
Hey @ilick888 thanks very much for this, and appreciate you helping close off #1009.
Would you be able to add this as an opt-in flag? I think it's probably best to keep it so folks intentionally opt-in to it, given it's going to change a lot of generated code, mostly unnecessarily.
Or alternatively, we make it so it only applies when just generating types?
Thoughts?