test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_additional_properties.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD eb4f035e_ec14_ab92_ec93_6bca5d766883["test_openapi_schema()"] 282c0505_addc_df54_19f4_afdc03b8dfce["test_additional_properties.py"] eb4f035e_ec14_ab92_ec93_6bca5d766883 -->|defined in| 282c0505_addc_df54_19f4_afdc03b8dfce style eb4f035e_ec14_ab92_ec93_6bca5d766883 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_additional_properties.py lines 27–114
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": {
"/foo": {
"post": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Foo",
"operationId": "foo_foo_post",
"requestBody": {
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/Items"}
}
},
"required": True,
},
}
}
},
"components": {
"schemas": {
"Items": {
"title": "Items",
"required": ["items"],
"type": "object",
"properties": {
"items": {
"title": "Items",
"type": "object",
"additionalProperties": {"type": "integer"},
}
},
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
},
},
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
"input": {"title": "Input"},
"ctx": {"title": "Context", "type": "object"},
},
},
"HTTPValidationError": {
"title": "HTTPValidationError",
"type": "object",
"properties": {
"detail": {
"title": "Detail",
"type": "array",
"items": {
"$ref": "#/components/schemas/ValidationError"
},
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_additional_properties.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_additional_properties.py at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free