WeblateOrg / weblate

Web based localization tool with tight version control integration.
https://weblate.org/
GNU General Public License v3.0
4.52k stars 997 forks source link

Describe the Weblate REST API with OpenAPI #12584

Open walpox opened 3 days ago

walpox commented 3 days ago

Describe the problem

There is not a problem to solve per se. The current API documentation is good. In my opinion, the proposed OpenAPI standard might be an improvement upon such documentation.

Describe the solution you would like

OpenAPI (formerly known as Swagger) is one of the most popular specifications to describe REST APIs formally. It allows developers to define the entire Weblate REST API with a root OpenAPI document.

Some advantages this standard might offer over the current API documentation are:

Describe alternatives you have considered

No response

Screenshots

This is how the Weblate REST API looks in Swagger UI:

Click to show image

In Sphinx with sphinxcontrib-openapi:

Click to show image

In Sphinx with sphinxcontrib-redoc:

Click to show image

Additional context

Compared to Swagger UI, the Sphinx plugins are missing information and seem to work worse. If we can get drf_spectacular to work with Weblate, it should be possible to offer the OpenAPI document programmatically and letting people use it as they please.

nijel commented 13 hours ago

https://github.com/WeblateOrg/weblate/pull/12612 integrates drf-spectacular to Weblate. This gives some OpenAPI schema, but it is very likely incomplete and needs additional annotations to make it really a replacement for the current documentation. But I think it's the correct direction that will allow us to discard manually maintained documentation in the future.