How to hide `Schemas` section in `/docs`?
See original GitHub issuefrom fastapi import FastAPI
from pydantic.main import BaseModel
app = FastAPI()
class Model(BaseModel):
a: str
@app.get("/", response_model=BaseModel)
def get():
return {"a": "b"}
After uvicorn app:app
, /docs
shows this:
Is there any way to hide Schemas
section with the BaseModel
? I don’t want to remove the schema definitions from the API spec. Instead, I just want to remove them from the render. I’ve checked out Extending OpenAPI, but didn’t find anything related.
I found How to hide the Models section in Swagger UI? which mentions a field called defaultModelsExpandDepth
, but not sure how I could configure such a thing through FastAPI.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
How to hide the Models section in Swagger UI? - Stack Overflow
To hide the "Models" section, add defaultModelsExpandDepth: -1 to the Swagger UI configuration code in your index.html .
Read more >Hide Endpoints And Schemas from Swagger / OpenAPI
Remove Swagger endpoints from OpenAPI documentation. Remove schemas from Swagger. Hide swagger endpoints via Swashbuckle filters.
Read more >Learn About Article Schema Markup | Google Search Central
Learn how adding article schema markup to your news articles and blogs can enhance their appearance in Google Search results.
Read more >OpenAPI Specification - Version 2.0 - Swagger
Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a...
Read more >OpenAPI 3 Library for spring-boot
/api-docs endpoint custom path springdoc.api-docs.path=/api-docs ... The javadoc comment of an attribute: is resolved as '@Schema' ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FastAPI now supports passing swagger parameters, so to hide the schemas you can do it as below:
it works. thank’s.