test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_tutorial003_tutorial004.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 3ba74c8f_10eb_ec53_4c52_1085d9709aaa["test_openapi_schema()"] e2e636f3_7553_15fb_3b09_b56410b7ca46["test_tutorial003_tutorial004.py"] 3ba74c8f_10eb_ec53_4c52_1085d9709aaa -->|defined in| e2e636f3_7553_15fb_3b09_b56410b7ca46 style 3ba74c8f_10eb_ec53_4c52_1085d9709aaa fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py lines 65–213
def test_openapi_schema(client: TestClient, mod_name: str):
mod_name = mod_name[:11]
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": {
"summary": "Create an item",
"description": Is(DESCRIPTIONS[mod_name]),
"operationId": "create_item_items__post",
"requestBody": {
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/Item"}
}
},
"required": True,
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/Item"}
}
},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
},
},
},
"components": {
"schemas": {
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError",
},
"title": "Detail",
"type": "array",
},
},
"title": "HTTPValidationError",
"type": "object",
},
"Item": {
"properties": {
"description": {
"anyOf": [
{
"type": "string",
},
{
"type": "null",
},
],
"title": "Description",
},
"name": {
"title": "Name",
"type": "string",
},
"price": {
"title": "Price",
"type": "number",
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_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py at line 65.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free