go-restful-swagger12 icon indicating copy to clipboard operation
go-restful-swagger12 copied to clipboard

The package go-restful-swagger12 does not display all operations in swagger.json

Open azenakhi opened this issue 7 years ago • 6 comments

Hello,

I tried to test https://github.com/emicklei/go-restful/blob/master/examples/restful-user-resource.go, but go-restful-swagger12 does not display all operations ?

$ curl http://localhost:8080/swagger.json { "swaggerVersion": "1.2", "apis": [ { "path": "/users", "description": "Manage Users hello " } ], "apiVersion": "", "info": { "title": "", "description": "" } }

Thanks by advance. Best regards, Ahmed ZENAKHI

azenakhi avatar Jun 25 '17 02:06 azenakhi

use this rule in version 1.2 $ curl http://localhost:8080/{SwaggerPath}/{path}/

in your case: $ curl http://localhost:8080/swagger.json/users/

OmidHekayati avatar Jun 29 '17 13:06 OmidHekayati

Thanks. It works. Can we use the 2.0 version of swagger ?

azenakhi avatar Jun 30 '17 08:06 azenakhi

Yes, Why not! in version 2 all document represent in one json in this url: $ curl http://{host}/{SwaggerPath}/ and you have a key for {path} inside that json. response Json template is like this:

{
"schemes": [],
"swagger": "2.0",
"info": {},
"host": "",
"paths": {}
}

OmidHekayati avatar Jun 30 '17 14:06 OmidHekayati

Thanks

azenakhi avatar Jul 01 '17 12:07 azenakhi

Hi. Great work, your project is very cool. I use it in my project some time. But now I need to use swagger of 2 version. In the previous answer you said it possible, but I don't understand how. Could you explain how I can do it.

vbondarev avatar Jul 06 '17 07:07 vbondarev

I tried to use go-restful-openapi and it works as I want ))))

vbondarev avatar Jul 06 '17 11:07 vbondarev