test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_multi_body_errors.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD e85dc7f7_da85_178a_4398_8ef7825393dd["test_openapi_schema()"] 789994cf_4c09_9ccd_b82e_26362f9d8f29["test_multi_body_errors.py"] e85dc7f7_da85_178a_4398_8ef7825393dd -->|defined in| 789994cf_4c09_9ccd_b82e_26362f9d8f29 style e85dc7f7_da85_178a_4398_8ef7825393dd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_multi_body_errors.py lines 89–191
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 Item No Body",
"operationId": "save_item_no_body_items__post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"title": "Item",
"type": "array",
"items": {"$ref": "#/components/schemas/Item"},
}
}
},
"required": True,
},
}
}
},
"components": {
"schemas": {
"Item": {
"title": "Item",
"required": ["name", "age"],
"type": "object",
"properties": {
"name": {"title": "Name", "type": "string"},
"age": {
"title": "Age",
"anyOf": [
{"exclusiveMinimum": 0.0, "type": "number"},
IsOneOf(
# pydantic < 2.12.0
{"type": "string"},
# pydantic >= 2.12.0
{
"type": "string",
"pattern": r"^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$",
},
),
],
},
},
},
"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"},
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_multi_body_errors.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_multi_body_errors.py at line 89.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free