WebAPI: Document API using OpenAPI #21817
Draft
+314
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is simply a demo to foster input from the community.
The process of documenting the WebAPI leaves a lot to be desired. Both in terms of actually writing down the specs and rendering them in a visually pleasing way to the end user.
The OpenAPI spec was developed for this and seems to be industry standard.
A quick guide is here.
Since it is standardized there are loads of tools that help with exploring the API, writing clients, validating, rendering documentation etc.
I am interested mainly in a) providing an easy way for others to validate their clients and b) generating helpful documentation.
I have documented the APIs of the
transfer
andauth
controllers as a demo. As you can see each controller can be documented in its own YAML and be referenced by the main YAML. This will help with incrementally implementing OpenAPI if we decide to go that route.If we decide to use OpenAPI, then for each controller that is documented we will require that each PR that affects its API to also make necessary changes to the OpenAPI yaml.
The generated docs can be hooked up to be served by the mainsite (CI integration should help here).
You can preview it here: https://www.qbittorrent.org/openapi-demo/