-
Notifications
You must be signed in to change notification settings - Fork 0
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
Choose an OpenAPI generator library #62
Comments
Following @altergui instructions, I tried swago (from vocdoni node repo): cd api
go get github.com/swaggo/swag/cmd/swag
go run github.com/swaggo/swag/cmd/swag init --parseDependency --parseDepth 1 --parseInternal -g api.go This generate a Yaml swagger specification, I found the following problems:
/accounts:
post:
description: Set account information
responses:
"200":
description: OK
schema:
$ref: '#/components/schemas/blah'
summary: Set account Should be: /accounts:
post:
description: Set account information
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/blah'
summary: Set account This causes that the generated docusaurus pages are broken.
On conclusion, it seems that the only breaking issue is the first one, we have to see if is a swaggo problem or what. Apart of this, it seem we could document everything inside the code and generate the swagger automatically. We have to migrate all the existing documentation to there, and do more tests to see if something else will break. For example, some endpoints need bearer auth tokens, we have to see if are correctly parsed. |
Thanks @selankon The Anyway, please, could you paste here the yaml file generated? Also, Regards. |
Thanks @altergui Now, we should check what OpenAPI version supports Docusaurus. @selankon any idea? Regards. |
Hi @chilcano We are using a docusaurus package to generate the docs: https://github.com/PaloAltoNetworks/docusaurus-openapi-docs (is not a docusaurus feature). Reading the README.md should work with Swagger 2.0 and OpenAPI 3.0. And in fact, I was using the generated Swagger 2.0 schema with the OpenAPI 3.0 annotation, which is an error. After running it again with the correct tag I saw this message when generating the docs: So, after correcting the tag, everything worked as expected and the generated pages seems working now! BTW: swaggo/swag#548 (comment) swaggo has beta suport for OpenAPI 3.0 on April 6 :) |
If Docusaurus (and plugin) can process the generated swagger 2.0 yaml by default, then that is good news @selankon !! This confirms that What do you think @altergui and @selankon ? Regards. |
Hi @chilcano From the docs of swaggo it seems that a version tag could be added on the information section, for example. And on docusaurus side we can generate different api docs for different versions using different yaml. So, it is possible to be done. The only thing on all this system is that a lot of documentation are wrote on the code, maybe hindering readability. We have to balance if we want to move all documentation to the code (is also a good amount of work, easy but extended). |
That is great @selankon !! IMO, I think that the golang code should have a minimum documentation (in the golang code itself), that should generate an initial swagger yaml file that can be used in the subsequent processes such as publish it as it or enrich it to be published on developer portal as Docusaurus documentation. What do you think? |
Extra resources to enrich the API documentation based:
Next steps:
Ref: #65 |
FTR codeExampleFiles option is used to give code samples like curl so is not needed for us |
Choose an OpenAPI generator library evaluating:
The text was updated successfully, but these errors were encountered: