Open cbarlock opened 4 years ago
Looks like I stumbled on the answer. The values in the parameter structures have to be exported (Capitalized). Why is this? The parameter structures are defined in the same package as the routes.
This seems restrictive. How do I include query parameters that do not start with capital letter in generated swagger spec? As per URI RFC other than scheme and host other components of URI are case sensitive.
Also, this seems to be a regression. Version v0.20.1
seems to be able to generate query parameters that are not exported/capitalized.
This only refers to your go code. The json:"differentNameOrCapitalization"
struct tag is used for naming purposes in the generated spec
@casualjim Thanks! I somehow missed that it honors json tags as well when generating specs. Adding json tags solved the issue.
Problem statement
I have the following go-swagger annotation:
I generate the swagger YAML with
swagger generate spec -o docs/swagger.yaml -w eprouter
. The resulting YAML does not include the query parameter. My understanding is that the identifier callbackReg should tie the parameter structure to the route. What am I doing wrong?The generated YAML:
Environment
swagger version version: v0.22.0 commit: 5773cbe63c3f459b23ed73ad8b482389ddf46cb4
go version: 1.13.6 OS: MacOS