tabbyAPI-ollama/generate_openapi.py
kingbri 5e82b7eb69 API: Add standalone method to fetch OpenAPI docs
Generates and stores an export of the openapi.json file for use in
static websites.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-07-07 21:35:52 -04:00

13 lines
324 B
Python

import json
from endpoints import server
if __name__ == "__main__":
"""Uses the FastAPI server to write an OpenAPI JSON documentation file."""
server.setup_app()
openapi_json = json.dumps(server.app.openapi())
# Write JSON to a file
with open("openapi.json", "w") as f:
f.write(openapi_json)