test_openapi_schema() — fastapi Function Reference
Architecture documentation for the test_openapi_schema() function in test_webhooks_security.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 6265721e_90bb_fe7f_a258_cb2bf9efa4ef["test_openapi_schema()"] 264b13a6_44a6_f021_eb11_326f5a115ba2["test_webhooks_security.py"] 6265721e_90bb_fe7f_a258_cb2bf9efa4ef -->|defined in| 264b13a6_44a6_f021_eb11_326f5a115ba2 style 6265721e_90bb_fe7f_a258_cb2bf9efa4ef fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_webhooks_security.py lines 39–134
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": {},
"webhooks": {
"new-subscription": {
"post": {
"summary": "New Subscription",
"description": "When a new user subscribes to your service we'll send you a POST request with this\ndata to the URL that you register for the event `new-subscription` in the dashboard.",
"operationId": "new_subscriptionnew_subscription_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Subscription"
}
}
},
"required": True,
},
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
},
},
"security": [{"HTTPBearer": []}],
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail",
}
},
"type": "object",
"title": "HTTPValidationError",
},
"Subscription": {
"properties": {
"username": {"type": "string", "title": "Username"},
"monthly_fee": {"type": "number", "title": "Monthly Fee"},
"start_date": {
"type": "string",
"format": "date-time",
"title": "Start Date",
},
},
"type": "object",
"required": ["username", "monthly_fee", "start_date"],
"title": "Subscription",
},
"ValidationError": {
"properties": {
"ctx": {"title": "Context", "type": "object"},
"input": {"title": "Input"},
"loc": {
"items": {
"anyOf": [{"type": "string"}, {"type": "integer"}]
},
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_webhooks_security.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_webhooks_security.py at line 39.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free