tiangolo/full-stack-fastapi-couchbase

Hide endpoint in interactive documentation

zero0nee opened this issue ยท 8 comments

Hi! this is not really a bug or an issue. It's more of a questions.

When I deploy the project I don't want /api/v1/api/v1/users/ and some other endpoints to displayed in the interactive Swagger/Redoc documentation. In other words, I want to hide them from the interactive documentation. Is this possible somehow?

@tiangolo You just made my day! ๐Ÿฅ‡

Great! ๐Ÿ˜

Yes, you can exclude them from the generated OpenAPI: https://fastapi.tiangolo.com/tutorial/path-operation-advanced-configuration/#exclude-from-openapi

LInk isn't available anymore

So many links... The answer is to set the include_in_schema flag to False inside the decorator.
Here is the example code from the documentation:

@app.get("/items/", include_in_schema=False)
async def read_items():
    return [{"item_id": "Foo"}]

Have a use case, here I would like to only hide endpoints without a tag.
Any idea how can I achieve that ? Don't see anything related from the documentation