test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_tutorial001.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD b611a080_be1d_4452_02ee_181c67dd5568["test_openapi_schema()"] 4635dc70_c39c_9acd_d962_f94f64b32b98["test_tutorial001.py"] b611a080_be1d_4452_02ee_181c67dd5568 -->|defined in| 4635dc70_c39c_9acd_d962_f94f64b32b98 style b611a080_be1d_4452_02ee_181c67dd5568 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_tutorial/test_body_fields/test_tutorial001.py lines 75–191
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": {
"/items/{item_id}": {
"put": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"summary": "Update Item",
"operationId": "update_item_items__item_id__put",
"parameters": [
{
"required": True,
"schema": {"title": "Item Id", "type": "integer"},
"name": "item_id",
"in": "path",
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Body_update_item_items__item_id__put"
}
}
},
"required": True,
},
}
}
},
"components": {
"schemas": {
"Item": {
"title": "Item",
"required": ["name", "price"],
"type": "object",
"properties": {
"name": {"title": "Name", "type": "string"},
"description": {
"title": "The description of the item",
"anyOf": [
{"maxLength": 300, "type": "string"},
{"type": "null"},
],
},
"price": {
"title": "Price",
"exclusiveMinimum": 0.0,
"type": "number",
"description": "The price must be greater than zero",
},
"tax": {
"title": "Tax",
"anyOf": [{"type": "number"}, {"type": "null"}],
},
},
},
"Body_update_item_items__item_id__put": {
"title": "Body_update_item_items__item_id__put",
"required": ["item"],
"type": "object",
"properties": {"item": {"$ref": "#/components/schemas/Item"}},
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_body_fields/test_tutorial001.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_tutorial/test_body_fields/test_tutorial001.py at line 75.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free