test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_tutorial001.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 7ff09679_761e_a713_00ec_03f2b74d5bf3["test_openapi_schema()"] af88d2cf_62a9_8cd6_16c9_504debd90f89["test_tutorial001.py"] 7ff09679_761e_a713_00ec_03f2b74d5bf3 -->|defined in| af88d2cf_62a9_8cd6_16c9_504debd90f89 style 7ff09679_761e_a713_00ec_03f2b74d5bf3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_tutorial/test_extending_openapi/test_tutorial001.py lines 15–50
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == snapshot(
{
"openapi": "3.1.0",
"info": {
"title": "Custom title",
"summary": "This is a very custom OpenAPI schema",
"description": "Here's a longer description of the custom **OpenAPI** schema",
"version": "2.5.0",
"x-logo": {
"url": "https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png"
},
},
"paths": {
"/items/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Read Items",
"operationId": "read_items_items__get",
}
}
},
}
)
openapi_schema = response.json()
# Request again to test the custom cache
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == openapi_schema
Domain
Subdomains
Source
Frequently Asked Questions
What does test_openapi_schema() do?
test_openapi_schema() is a function in the fastapi codebase, defined in tests/test_tutorial/test_extending_openapi/test_tutorial001.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_tutorial/test_extending_openapi/test_tutorial001.py at line 15.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free