test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_union_inherited_body.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD d04a118c_da10_9bb3_20dc_1ee101177bb9["test_openapi_schema()"] 3eabdbc0_2eb6_83c7_313a_f061f310f0ab["test_union_inherited_body.py"] d04a118c_da10_9bb3_20dc_1ee101177bb9 -->|defined in| 3eabdbc0_2eb6_83c7_313a_f061f310f0ab style d04a118c_da10_9bb3_20dc_1ee101177bb9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_union_inherited_body.py lines 39–144
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": {
"/items/": {
"post": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Save Union Different Body",
"operationId": "save_union_different_body_items__post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"title": "Item",
"anyOf": [
{
"$ref": "#/components/schemas/ExtendedItem"
},
{"$ref": "#/components/schemas/Item"},
],
}
}
},
"required": True,
},
}
}
},
"components": {
"schemas": {
"Item": {
"title": "Item",
"type": "object",
"properties": {
"name": {
"title": "Name",
"anyOf": [{"type": "string"}, {"type": "null"}],
}
},
},
"ExtendedItem": {
"title": "ExtendedItem",
"required": ["age"],
"type": "object",
"properties": {
"name": {
"title": "Name",
"anyOf": [{"type": "string"}, {"type": "null"}],
},
"age": {"title": "Age", "type": "integer"},
},
},
"ValidationError": {
"title": "ValidationError",
"required": ["loc", "msg", "type"],
"type": "object",
"properties": {
"loc": {
"title": "Location",
"type": "array",
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
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_union_inherited_body.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_union_inherited_body.py at line 39.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free