test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_union_forms.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 293461b6_d459_b110_e9ab_6a885145055e["test_openapi_schema()"] 011d8797_cc26_2e3a_cf84_44b49ef9936b["test_union_forms.py"] 293461b6_d459_b110_e9ab_6a885145055e -->|defined in| 011d8797_cc26_2e3a_cf84_44b49ef9936b style 293461b6_d459_b110_e9ab_6a885145055e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_union_forms.py lines 62–163
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": {
"/form-union/": {
"post": {
"summary": "Post Union Form",
"operationId": "post_union_form_form_union__post",
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"anyOf": [
{"$ref": "#/components/schemas/UserForm"},
{
"$ref": "#/components/schemas/CompanyForm"
},
],
"title": "Data",
}
}
},
"required": True,
},
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
}
},
"components": {
"schemas": {
"CompanyForm": {
"properties": {
"company_name": {"type": "string", "title": "Company Name"},
"industry": {"type": "string", "title": "Industry"},
},
"type": "object",
"required": ["company_name", "industry"],
"title": "CompanyForm",
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail",
}
},
"type": "object",
"title": "HTTPValidationError",
},
"UserForm": {
"properties": {
"name": {"type": "string", "title": "Name"},
"email": {"type": "string", "title": "Email"},
},
"type": "object",
"required": ["name", "email"],
"title": "UserForm",
},
"ValidationError": {
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_union_forms.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_union_forms.py at line 62.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free