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

Enhancement: Add swagger API documentation #879

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

parmesant
Copy link
Contributor

@parmesant parmesant commented Aug 8, 2024

Description

Adds API documentation using utoipa from within Rust code. Also generates an up-to-date openapi yaml spec as soon as the server starts up.
To view the swagger page, go to {endpoint}/swagger-ui/

To build the docusaurus page follow these steps-

rm -rf build/ # Remove the old build directory (might be unnecessary)
yarn docusaurus clean-api-docs all #  remove pre-existing `mdx` files
yarn docusaurus gen-api-docs all # make new `mdx` files
yarn docusaurus build # build the server (or use whatever command you use to build production server)
npm run serve # Serve (or use production command)

Covered scopes-

  • logstream
  • query
  • ingestion
  • user
  • rbac
  • liveness (partial since can't add two variants of the same endpoint)
  • readiness (partial since can't add two variants of the same endpoint)

Quirks

Request headers are specified as an attribute for params of a request and hence can't be optional (added a note in their description explaining their nature)


This PR has:

  • been tested to ensure log ingestion and log query works.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added documentation for new or modified features or behaviors.

Copy link
Contributor

github-actions bot commented Aug 8, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@parmesant parmesant changed the title utoipa init commit Enhancement: Add swagger API documentation Aug 8, 2024
@parmesant
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@parmesant parmesant marked this pull request as ready for review August 14, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant