test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_tutorial002.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 8185008b_e3c0_0c17_2173_a7d547815fdf["test_openapi_schema()"] 24c45a29_accd_8258_a7da_ddf6ea0170f4["test_tutorial002.py"] 8185008b_e3c0_0c17_2173_a7d547815fdf -->|defined in| 24c45a29_accd_8258_a7da_ddf6ea0170f4 style 8185008b_e3c0_0c17_2173_a7d547815fdf fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_tutorial/test_sql_databases/test_tutorial002.py lines 150–438
def test_openapi_schema(client: TestClient):
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": {
"/heroes/": {
"post": {
"summary": "Create Hero",
"operationId": "create_hero_heroes__post",
"requestBody": {
"required": True,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HeroCreate"
}
}
},
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HeroPublic"
}
}
},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
},
"get": {
"summary": "Read Heroes",
"operationId": "read_heroes_heroes__get",
"parameters": [
{
"name": "offset",
"in": "query",
"required": False,
"schema": {
"type": "integer",
"default": 0,
"title": "Offset",
},
},
{
"name": "limit",
"in": "query",
"required": False,
"schema": {
"type": "integer",
"maximum": 100,
"default": 100,
"title": "Limit",
},
},
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/HeroPublic"
},
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_sql_databases/test_tutorial002.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_tutorial/test_sql_databases/test_tutorial002.py at line 150.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free