test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_openapi_examples.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 5443d7ee_9896_8d11_fd58_b56b00e50787["test_openapi_schema()"] 8ac1d492_09f7_2975_cc25_f70aecbbb54b["test_openapi_examples.py"] 5443d7ee_9896_8d11_fd58_b56b00e50787 -->|defined in| 8ac1d492_09f7_2975_cc25_f70aecbbb54b style 5443d7ee_9896_8d11_fd58_b56b00e50787 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_openapi_examples.py lines 144–424
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": {
"/examples/": {
"post": {
"summary": "Examples",
"operationId": "examples_examples__post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Item",
"examples": [
{"data": "Data in Body examples, example1"}
],
},
"examples": {
"Example One": {
"summary": "Example One Summary",
"description": "Example One Description",
"value": {
"data": "Data in Body examples, example1"
},
},
"Example Two": {
"value": {
"data": "Data in Body examples, example2"
}
},
},
}
},
"required": True,
},
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
}
},
"/path_examples/{item_id}": {
"get": {
"summary": "Path Examples",
"operationId": "path_examples_path_examples__item_id__get",
"parameters": [
{
"name": "item_id",
"in": "path",
"required": True,
"schema": {
"type": "string",
"examples": [
"json_schema_item_1",
"json_schema_item_2",
],
"title": "Item Id",
},
"examples": {
"Path One": {
"summary": "Path One Summary",
"description": "Path One Description",
"value": "item_1",
},
"Path Two": {"value": "item_2"},
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_openapi_examples.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_openapi_examples.py at line 144.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free