go-swagger: can not generate swagger spec
Problem statement
I run following command to generate swagger spec but it just prints 3 lines of yaml to swagger.yaml
command: swagger generate spec -o ./swagger.yaml
yaml output: info: {} paths: {} swagger: “2.0”
comments added to main file: // Package classification Petstore API. // // the purpose of this application is to provide an application // that is using plain go code to define an API // // This should demonstrate all the possible comment annotations // that are available to turn go code into a fully compliant swagger 2.0 spec // // Terms Of Service: // // there are no TOS at this moment, use at your own risk we take no responsibility // // Schemes: http, https // Host: localhost // BasePath: /v2 // Version: 0.0.1 // License: MIT http://opensource.org/licenses/MIT // Contact: John Doejohn.doe@example.com http://john.doe.com // // Consumes: // - application/json // - application/xml // // Produces: // - application/json // - application/xml // // Security: // - api_key: // // SecurityDefinitions: // api_key: // type: apiKey // name: KEY // in: header // oauth2: // type: oauth2 // authorizationUrl: /oauth2/auth // tokenUrl: /oauth2/token // in: header // scopes: // bar: foo // flow: accessCode // // Extensions: // x-meta-value: value // x-meta-array: // - value1 // - value2 // x-meta-array-obj: // - name: obj // value: field // // swagger:meta
Environment
swagger version: v0.30.2 go version: 1.19.1 OS: macOS monterey 12.6
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 18 (7 by maintainers)
This worked for me now though.