test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_enforce_once_required_parameter.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 68f99162_b8db_cfea_6b7f_8844ac58da66["test_openapi_schema()"] 89b3e51d_0fbd_0087_6e90_4db54680fe7c["test_enforce_once_required_parameter.py"] 68f99162_b8db_cfea_6b7f_8844ac58da66 -->|defined in| 89b3e51d_0fbd_0087_6e90_4db54680fe7c style 68f99162_b8db_cfea_6b7f_8844ac58da66 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_enforce_once_required_parameter.py lines 42–117
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200, response.text
assert response.json() == 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": {
"/foo": {
"get": {
"operationId": "foo_handler_foo_get",
"parameters": [
{
"in": "query",
"name": "client_id",
"required": True,
"schema": {"title": "Client Id", "type": "string"},
},
],
"responses": {
"200": {
"content": {"application/json": {"schema": {}}},
"description": "Successful Response",
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error",
},
},
"summary": "Foo Handler",
}
}
},
}
)
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_enforce_once_required_parameter.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_enforce_once_required_parameter.py at line 42.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free