Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

Architecture documentation for the test_openapi_schema() function in test_schema_ref_pydantic_v2.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  4ae10bce_93bc_496b_e825_2e0c1bf26a6e["test_openapi_schema()"]
  571c9a79_ce50_1841_2d22_31d60e4ced6e["test_schema_ref_pydantic_v2.py"]
  4ae10bce_93bc_496b_e825_2e0c1bf26a6e -->|defined in| 571c9a79_ce50_1841_2d22_31d60e4ced6e
  style 4ae10bce_93bc_496b_e825_2e0c1bf26a6e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_schema_ref_pydantic_v2.py lines 31–68

def test_openapi_schema(client: TestClient):
    response = client.get("openapi.json")
    assert response.json() == snapshot(
        {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/": {
                    "get": {
                        "summary": "Read Root",
                        "operationId": "read_root__get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/ModelWithRef"
                                        }
                                    }
                                },
                            }
                        },
                    }
                }
            },
            "components": {
                "schemas": {
                    "ModelWithRef": {
                        "properties": {"$ref": {"type": "string", "title": "$Ref"}},
                        "type": "object",
                        "required": ["$ref"],
                        "title": "ModelWithRef",
                    }
                }
            },
        }
    )

Domain

Subdomains

Frequently Asked Questions

What does test_openapi_schema() do?
test_openapi_schema() is a function in the fastapi codebase, defined in tests/test_schema_ref_pydantic_v2.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_schema_ref_pydantic_v2.py at line 31.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free