test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_repeated_dependency_schema.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD bddf6fd5_f432_f7e4_2c50_7489c665cb9c["test_openapi_schema()"] d238c745_3aac_eaa0_5d04_0329207de137["test_repeated_dependency_schema.py"] bddf6fd5_f432_f7e4_2c50_7489c665cb9c -->|defined in| d238c745_3aac_eaa0_5d04_0329207de137 style bddf6fd5_f432_f7e4_2c50_7489c665cb9c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_repeated_dependency_schema.py lines 30–109
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == status.HTTP_200_OK
actual_schema = response.json()
assert (
len(actual_schema["paths"]["/"]["get"]["parameters"]) == 1
) # primary goal of this test
assert actual_schema == snapshot(
{
"components": {
"schemas": {
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"title": "Detail",
"type": "array",
}
},
"title": "HTTPValidationError",
"type": "object",
},
"ValidationError": {
"properties": {
"ctx": {"title": "Context", "type": "object"},
"input": {"title": "Input"},
"loc": {
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
},
"title": "Location",
"type": "array",
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
},
"required": ["loc", "msg", "type"],
"title": "ValidationError",
"type": "object",
},
}
},
"info": {"title": "FastAPI", "version": "0.1.0"},
"openapi": "3.1.0",
"paths": {
"/": {
"get": {
"operationId": "get_deps__get",
"parameters": [
{
"in": "header",
"name": "someheader",
"required": True,
"schema": {"title": "Someheader", "type": "string"},
}
],
"responses": {
"200": {
"content": {"application/json": {"schema": {}}},
"description": "Successful Response",
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error",
},
},
"summary": "Get Deps",
}
}
},
}
)
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_repeated_dependency_schema.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_repeated_dependency_schema.py at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free