test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_response_model_as_return_annotation.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD c63b53d8_332a_acb3_555c_d50741bbc6d2["test_openapi_schema()"] cda67a9f_f26d_7734_ec51_1b0ee38954cf["test_response_model_as_return_annotation.py"] c63b53d8_332a_acb3_555c_d50741bbc6d2 -->|defined in| cda67a9f_f26d_7734_ec51_1b0ee38954cf style c63b53d8_332a_acb3_555c_d50741bbc6d2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_response_model_as_return_annotation.py lines 513–1123
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": "FastAPI", "version": "0.1.0"},
"paths": {
"/no_response_model-no_annotation-return_model": {
"get": {
"summary": "No Response Model No Annotation Return Model",
"operationId": "no_response_model_no_annotation_return_model_no_response_model_no_annotation_return_model_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
}
},
"/no_response_model-no_annotation-return_dict": {
"get": {
"summary": "No Response Model No Annotation Return Dict",
"operationId": "no_response_model_no_annotation_return_dict_no_response_model_no_annotation_return_dict_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
}
},
"/response_model-no_annotation-return_same_model": {
"get": {
"summary": "Response Model No Annotation Return Same Model",
"operationId": "response_model_no_annotation_return_same_model_response_model_no_annotation_return_same_model_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/User"}
}
},
}
},
}
},
"/response_model-no_annotation-return_exact_dict": {
"get": {
"summary": "Response Model No Annotation Return Exact Dict",
"operationId": "response_model_no_annotation_return_exact_dict_response_model_no_annotation_return_exact_dict_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/User"}
}
},
}
},
}
},
"/response_model-no_annotation-return_invalid_dict": {
"get": {
"summary": "Response Model No Annotation Return Invalid Dict",
"operationId": "response_model_no_annotation_return_invalid_dict_response_model_no_annotation_return_invalid_dict_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/User"}
}
},
}
},
}
},
"/response_model-no_annotation-return_invalid_model": {
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_response_model_as_return_annotation.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_response_model_as_return_annotation.py at line 513.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free