test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_regex_deprecated_body.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 4d6d9a01_819c_7942_5f19_4643a3f7a1d3["test_openapi_schema()"] 8f2fab8a_e459_dbe9_dda2_fbbd4b149368["test_regex_deprecated_body.py"] 4d6d9a01_819c_7942_5f19_4643a3f7a1d3 -->|defined in| 8f2fab8a_e459_dbe9_dda2_fbbd4b149368 ba6f8534_f1b5_5f03_50e5_0a510c4dc9b3["get_client()"] 4d6d9a01_819c_7942_5f19_4643a3f7a1d3 -->|calls| ba6f8534_f1b5_5f03_50e5_0a510c4dc9b3 style 4d6d9a01_819c_7942_5f19_4643a3f7a1d3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_regex_deprecated_body.py lines 64–154
def test_openapi_schema():
client = get_client()
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": "Read Items",
"operationId": "read_items_items__post",
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Body_read_items_items__post"
}
}
}
},
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
}
},
"components": {
"schemas": {
"Body_read_items_items__post": {
"properties": {
"q": {
"anyOf": [
{"type": "string", "pattern": "^fixedquery$"},
{"type": "null"},
],
"title": "Q",
}
},
"type": "object",
"title": "Body_read_items_items__post",
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail",
}
},
"type": "object",
"title": "HTTPValidationError",
},
"ValidationError": {
"properties": {
"ctx": {"title": "Context", "type": "object"},
"input": {"title": "Input"},
"loc": {
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
},
"type": "array",
"title": "Location",
},
"msg": {"type": "string", "title": "Message"},
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does test_openapi_schema() do?
test_openapi_schema() is a function in the fastapi codebase, defined in tests/test_regex_deprecated_body.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_regex_deprecated_body.py at line 64.
What does test_openapi_schema() call?
test_openapi_schema() calls 1 function(s): get_client.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free