parseable icon indicating copy to clipboard operation
parseable copied to clipboard

Enhancement: Add swagger API documentation

Open parmesant opened this issue 1 year ago • 2 comments

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:

  • [x] 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.
  • [x] added documentation for new or modified features or behaviors.

parmesant avatar Aug 08 '24 12:08 parmesant

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

github-actions[bot] avatar Aug 08 '24 12:08 github-actions[bot]

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

parmesant avatar Aug 09 '24 03:08 parmesant