test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_main.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD f1cfd020_9cd2_34e3_e861_ef6a9e45834b["test_openapi_schema()"] ac5068c6_5f86_7d74_f744_0a82a8c0acc2["test_main.py"] f1cfd020_9cd2_34e3_e861_ef6a9e45834b -->|defined in| ac5068c6_5f86_7d74_f744_0a82a8c0acc2 style f1cfd020_9cd2_34e3_e861_ef6a9e45834b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_modules_same_name_body/test_main.py lines 29–156
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": {
"/a/compute": {
"post": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Compute",
"operationId": "compute_a_compute_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_compute_a_compute_post"
}
}
},
"required": True,
},
}
},
"/b/compute/": {
"post": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Compute",
"operationId": "compute_b_compute__post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_compute_b_compute__post"
}
}
},
"required": True,
},
}
},
},
"components": {
"schemas": {
"Body_compute_b_compute__post": {
"title": "Body_compute_b_compute__post",
"required": ["a", "b"],
"type": "object",
"properties": {
"a": {"title": "A", "type": "integer"},
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_modules_same_name_body/test_main.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_modules_same_name_body/test_main.py at line 29.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free