Tags
Note
This post is a thought. It's a short note that I make about someone else's content online. Learn more about the process thoughts
Here's my thought on ๐ญ How to group FastAPI endpoints in Swagger UI?
Setting tags in your fastapi endpoints will group them in the docs. You can also set some metadata around the tags to get nice descriptions.
Here is a full example from the post.
from fastapi import FastAPI tags_metadata = [ {"name": "Get Methods", "description": "One other way around"}, {"name": "Post Methods", "description": "Keep doing this"}, {"name": "Delete Methods", "description": "KILL 'EM ALL"}, {"name": "Put Methods", "description": "Boring"}, ] app = FastAPI(openapi_tags=tags_metadata) @app.delete("/items", tags=["Delete Methods"]) @app.put("/items", tags=["Put Methods"]) @app.post("/items", tags=["Post Methods"]) @app.get("/items", tags=["Get Methods"]) async def handle_items(): return
This post was a thought by Waylon Walker see all my thoughts at https://waylonwalker.com/thoughts