go-swagger / go-swagger

Swagger 2.0 implementation for go
https://goswagger.io
Apache License 2.0
9.48k stars 1.25k forks source link

Interactive Swagger API for Golang #1477

Open lavishAgrawal opened 6 years ago

lavishAgrawal commented 6 years ago

Does go-swagger provide an interactive swagger API which can be used to modify the models or it just generates the documentation?

fredbi commented 6 years ago

go-swagger is essentially a generator. There are 2 main use-cases:

The tool comes as CLI with no support for interactive commands (an idea about this has been proposed: #139)

Additionally, go-swagger may be used to:

lavishAgrawal commented 6 years ago

What I meant by interactive swagger API is like 'when you click on any of the methods from generated swagger documentation, it should be able to do the corresponding operation in the DB.' Something similar to what loopback does in NodeJs. I hope you answered for the same? If this can't be achieved by Go-Swagger, is it possible to address this use case by any other Golang package?

fredbi commented 6 years ago

This "loopback-style" interactive feature is actually provided by the UI component (e.g. redoc or swagger UI), not directly by go-swagger.

If you run your generated server and serve the UI you should be able to exercise your API from the UI document.

casualjim commented 6 years ago

you would have to implement the interaction with the database yourself. this tool will just generate the skeleton for you