Skip to content

Path Operation 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 group endpoints in the docs:

@app.get("/users/", tags=["users"])
def list_users():
return []
@app.post("/items/", tags=["items"])
def create_item():
return {}
@app.get("/old-endpoint", deprecated=True)
def old_endpoint():
return {"message": "this endpoint is deprecated"}
@app.get("/internal", include_in_schema=False)
def internal_only():
return {"secret": "data"}

This hides the endpoint from OpenAPI documentation entirely.