justapi — /docs

Basic Configuration

from justapi import JustAPIApp

app = JustAPIApp()

@app.get(
    "/items/{item_id}",
    summary="Get an item",
    description="Retrieve a single item by its ID.",
    tags=["items"],
    response_description="The item",
)
def get_item(item_id: int):
    return {"item_id": item_id}

Tags

Tags group endpoints in the docs:

@app.get("/users/", tags=["users"])
def list_users():
    return []

@app.post("/items/", tags=["items"])
def create_item():
    return {}

Deprecating Endpoints

@app.get("/old-endpoint", deprecated=True)
def old_endpoint():
    return {"message": "this endpoint is deprecated"}

Controlling Doc Visibility

@app.get("/internal", include_in_schema=False)
def internal_only():
    return {"secret": "data"}

This hides the endpoint from OpenAPI documentation entirely.

See Also

JustAPI v2.0.9 — Open Source MIT License · Built with WebTUI · GitHub

NORMAL master justapi/docs
utf-8 Top 1:1