test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_schema_compat_pydantic_v2.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 6bf5623f_cc7c_1a2a_39d4_faa04788dfff["test_openapi_schema()"] fcd29191_bbfc_1eb6_fe6b_ff9e3a695a04["test_schema_compat_pydantic_v2.py"] 6bf5623f_cc7c_1a2a_39d4_faa04788dfff -->|defined in| fcd29191_bbfc_1eb6_fe6b_ff9e3a695a04 style 6bf5623f_cc7c_1a2a_39d4_faa04788dfff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_schema_compat_pydantic_v2.py lines 41–90
def test_openapi_schema(client: TestClient):
response = client.get("openapi.json")
assert response.json() == snapshot(
{
"openapi": "3.1.0",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/users": {
"get": {
"summary": "Get User",
"operationId": "get_user_users_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {"$ref": "#/components/schemas/User"}
}
},
}
},
}
}
},
"components": {
"schemas": {
"PlatformRole": {
"type": "string",
"enum": ["admin", "user"],
"title": "PlatformRole",
},
"User": {
"properties": {
"username": {"type": "string", "title": "Username"},
"role": {
"anyOf": [
{"$ref": "#/components/schemas/PlatformRole"},
{"enum": [], "title": "OtherRole"},
],
"title": "Role",
},
},
"type": "object",
"required": ["username", "role"],
"title": "User",
},
}
},
}
)
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_schema_compat_pydantic_v2.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_schema_compat_pydantic_v2.py at line 41.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free