Templates for the go-server generator of the OpenAPI Generator.
The templates are a fork of the original go-server generator templates.
- Enable DisallowUnknownFields on JSON decoder
- Optionally set response code and body on error
- Remove request logging
- Optionally set a logger to log errors in Controllers
- Pass context of the incoming
http.Request
to methods of a Service - Let methods of a Service return types
- Supports only one return type on methods of a Service
- Supports JSON encoding of response body only
See examples/petstore.
curl -L -o openapi-go-server.zip https://github.com/wndhydrnt/openapi-go-server/archive/master.zip
unzip openapi-go-server.zip
rm openapi-go-server.zip
mv openapi-go-server-master/go-server .
rm -rf openapi-go-server-master/
openapi-generator generate -i https://petstore.swagger.io/v2/swagger.json -o . --generator-name go-server --additional-properties=sourceFolder=api,packageName=api -t ./go-server