test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_filter_pydantic_sub_model_pv2.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 67aade70_2fdd_86e2_f6f2_b43493252c7b["test_openapi_schema()"] 2927101d_fb92_c1c6_6e38_9ecdc5507a94["test_filter_pydantic_sub_model_pv2.py"] 67aade70_2fdd_86e2_f6f2_b43493252c7b -->|defined in| 2927101d_fb92_c1c6_6e38_9ecdc5507a94 style 67aade70_2fdd_86e2_f6f2_b43493252c7b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_filter_pydantic_sub_model_pv2.py lines 76–184
def test_openapi_schema(client: TestClient):
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": {
"/model/{name}": {
"get": {
"summary": "Get Model A",
"operationId": "get_model_a_model__name__get",
"parameters": [
{
"required": True,
"schema": {"title": "Name", "type": "string"},
"name": "name",
"in": "path",
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ModelA"
}
}
},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
},
}
},
},
"ModelA": {
"title": "ModelA",
"required": ["name", "foo"],
"type": "object",
"properties": {
"name": {"title": "Name", "type": "string"},
"description": {
"title": "Description",
"anyOf": [{"type": "string"}, {"type": "null"}],
},
"foo": {"$ref": "#/components/schemas/ModelB"},
"tags": {
"additionalProperties": {"type": "string"},
"type": "object",
"title": "Tags",
"default": {},
},
},
},
"ModelB": {
"title": "ModelB",
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_openapi_schema() do?
test_openapi_schema() is a function in the fastapi codebase, defined in tests/test_filter_pydantic_sub_model_pv2.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_filter_pydantic_sub_model_pv2.py at line 76.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free