No operations defined in spec!
Hello, Having this issue - No operations defined in spec! json file is accessiable: http://localhost:8081/swagger/doc.json
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server.",
"title": "Test api",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"url": "http://www.swagger.io/support",
"email": "[email protected]"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.0"
},
"host": "localhost:8081",
"basePath": "/api",
"paths": {}
}
I don't see any paths though.
Api itself works just fine.
Is there a way to debug this?
Thanks!
Hi @kotyara85
Check out this example:
https://github.com/swaggo/swag/blob/master/example/basic/api/api.go#L8
Probably it would require to place the comments for the each API endpoint to generate properly docs.go file.
But I am not 100% sure about that. I've just started the integration myself.
In the comments, @Router this must start with ‘/’
Having same issue, getting "No operations defined in spec!" even though my swagger.yaml and swagger.json file is generated correctly. When copy-pasted my YAML file content in http://editor.swagger.io/, it is working as expected but showing the error in http://localhost:8080/swagger/index.html
Anyone know, why this error "No operations defined in spec!" comes up? and what needs to be done in that case
This helped me solve my issue https://github.com/swaggo/gin-swagger/issues/73#issuecomment-523878582
Have you solved this problem? How did you solve it?