-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement automatic API documentation for the LCD #2179
Comments
Amazing! |
We are going with swagger documentation. The Bianje LCD PR implements this. #2199 |
As far as I understand #2199 this is not a automatically generated documentation. Am I wrong? |
@faboweb That PR does have auto generated docs for the LCD implementation |
Then I didn't understand the PR correctly. I thought this just generates a visual documentation from a static swagger file. Feel free to close this issue if I am wrong. |
My understanding of the PR is that it generates the swagger file from the golang code using https://github.com/swaggo/swag. So this would be autogenerated documentation unless I'm misreading things... |
We have switched to swagger. I'm going to go ahead and close this issue. |
Reopening this issue (not sure why it was closed?). Taking a look at https://github.com/swaggo/swag this seems to be what we need. I haven't tested this yet, but ideally we'd annotate each handler and have some sort of script that gathers and generates a single doc file which we use. @tnachen I see this as high priority because Swagger is often a big point for us in terms of keeping it up to date. |
Assigning this to myself and will be working on the handlers piecemeal. |
Before I created PR #2199, I had investigated https://github.com/swaggo/swag. At that time, swag tool has some defects. It can't generate right swagger yaml files if the data structure is too complicated, such as array of struct. So I had to choose a manual way to generate swagger yaml. |
@HaoyangLiu do you have concrete examples? We are able to annotate return types that have arrays (e.g. validators) |
The main defects I found one years ago:
Now if the above defects are solved or some defects are acceptable, then you can start to integrate swag with gaiacli |
This isn't true anymore I think. So far it works and we have handlers implemented in modules.
Also not true anymore I believe. That said, we are having some issues with the types being rendered. If you checkout #5038 and run |
gRPC swagger gen does this |
Summary
The Swagger REST documentation is updated manually and in 90% of the cases out of sync. Let's implement a process to updated the documentation automatically. I think we have this for Tendermint already.
Proposal
Investigate https://github.com/swaggo/swag by taking a simple module and adding annotations and generating a Swagger doc for it. If it works, perform this for all handlers and create the necessary scripts/CI tasks needed to automate and document it.
For Admin Use
The text was updated successfully, but these errors were encountered: