Add Utility support for swagger UI documentation for REST endpoints #3600
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.
Janus Gateway Tools
This directory contains helper utilities for generating and maintaining Janus Gateway documentation.
generate_swagger.pygenerate_swagger.pyinspectssrc/janus.cand produces an OpenAPI document that describes both the public/janusAPI and the administrative/adminAPI. The script can also serve the specification through an embedded Swagger UI for quick local exploration.Prerequisites
From the repository root, run the script with
python3 tools/generate_swagger.py.Common workflows
Generate the specification file
Writes the rendered OpenAPI document to
docs/swagger.json.Print the specification to stdout
Useful for piping the output to other tooling.
Check whether
docs/swagger.jsonis up to dateExits with status
0when the existing file matches the generated output, otherwise exits with1. Handy for CI jobs that enforce documentation freshness.Serve the spec with Swagger UI
Starts a local development server at
http://127.0.0.1:8000/(configurable with--hostand--port). The UI automatically fetches the freshly generated specification. Combine with--no-writeto avoid touchingdocs/swagger.jsonduring ad-hoc previews.Additional options
--source: path tojanus.crelative to the repository root (defaults tosrc/janus.c).--output: destination path for the generated OpenAPI document (defaults todocs/swagger.json).--no-write: skip writing the output file, typically paired with--serve.Run
python3 tools/generate_swagger.py --helpto see the full list of supported flags.