Skip to content
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

[DOC] Generate API documentation from spec #7700

Open
dblock opened this issue Jul 12, 2024 · 2 comments
Open

[DOC] Generate API documentation from spec #7700

dblock opened this issue Jul 12, 2024 · 2 comments
Labels
2 - In progress Issue/PR: The issue or PR is in progress. discuss

Comments

@dblock
Copy link
Member

dblock commented Jul 12, 2024

What do you want to do?

The https://github.com/opensearch-project/opensearch-api-specification repo contains and publishes the machine-readable reference of the APIs in OpenAPI format, along with runnable tests that execute an actual version of OpenSearch. The spec is work in progress, but has some solid coverage of core, and soon to have coverage of plugins before EOY 2024. The spec also supports description, x-version-added/removed/deprecated fields, and much more.

We propose to generate the documentation reference from spec instead of authoring it by hand.

  1. Author a basic tool in this repo (probably ruby since the jekyll ecosystem is all Ruby) that walks the spec.
  2. Identify missing documentation that is documented in the spec.
  3. Identify missing specs for APIs that are documented here.
  4. Bridge the gaps between spec and docs, including [FEATURE] Require, standardize and import descriptions. opensearch-api-specification#403 and Incorrect server versions for the API models opensearch-api-specification#120.
  5. Replace API reference with generated docs that combines humanly authored content with generated parts.
  6. Automate the update process. With every API change a PR will be opened in this repo updating the generated docs.
@nhtruong
Copy link
Contributor

nhtruong commented Jul 12, 2024

To provide some context for those not familiar with the API Spec repo:

  • Each of our spec test (aka a test story) provides a narrative that can be used to generate guides with setup, and tear down steps. Since we've built the test framework ourselves, we can also modify it too support generating guides in different programing languages.
  • We should treat the spec as the source of truth. Technical details like the data structure and description of a query param for example, must be updated in the spec first. The update in the spec then will be propagated to the generated clients (in terms of method documentation and data typing) and the document website (The affected query params table will be updated instantaneously). This will keep the clients and the docs always up-to-date and consistent.
  • We can also work with devs from the docs repo on how to consume the spec. Say if there's an article on how to search on OpenSearch and it includes a table with all query parameters for the search endpoint. Instead of writing and updating that table by hand, we should automatically generate that table from the spec.

@kolchfa-aws
Copy link
Collaborator

Once this is implemented and all clients are generated using the spec, it'd be nice to add a dropdown to all code blocks that users can use to choose the language for the code block. That way, client documentation can be integrated with the REST documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - In progress Issue/PR: The issue or PR is in progress. discuss
Projects
None yet
Development

No branches or pull requests

5 participants