FAQ #
This FAQ is a recap of questions reported by the community.
You may search past and current issues labelled as “question”.
Original issues are kept as links for additional details about the inquirer’s use-case.
We regularly update this document based on questions asked by the community in the “issues” section of the go-swagger repository.
You may also find most recent questions on Github here.
Feel free to contribute new questions and share your experience with go-swagger!
Disclaimer: some of this material might be outdated, as the project is constantly evolving.
All contributed questions #
Installation,setup and environment #
Model generation #
- Custom validation
- Non-required or nullable property?
- String parameter in body and query?
- Request response can have different objects returned based on query parameters
- How to validate dates and times?
- Accessing the return value from Default response
- How to avoid deep copies of complex data structures that need to be marshalled across the API?
- Extra sections in POST body
- How to support generate type int?
- Generate all models necessary for specified operation
- Generated code changes the order of properties in struct
- Fail to use swagger generate model -name
Server generation and customization #
- What are the dependencies required by the generated server?
- How to add custom flags?
- How do you integrate the flag sets of go-swagger and other packages, in particular, glog?
- How to serve two or more swagger specs from one server?
- How to access access API struct inside operator handler?
- Use go-swagger to generate different client or servers
- Support streaming responses
- OAuth authentication does not redirect to the authorization server
- HTTPS TLS Cipher Suites not supported by AWS Elastic LoadBalancer
- Which mime types are supported?
- Is it possible to return error to main function of server?
Client generation #
Spec generation from source #
- Is there an example to generate a swagger spec document from the code?
- Extra function in example
- Maps as swagger:parameters
- How to define a swagger:response that produces a binary file?
- How to use swagger:params?
- Empty Definitions as a result?
- Documentation / Tutorials?
- Wrong schema in response structure?
- go-swagger not generating model info and showing error on swagger UI
API testing #
Documenting your API #
- Serving swagger-ui with the API Server
- Serving UI from existing app
- How to use swagger-ui/cors?
- Serving my own UI files