Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  edfd00a0_dabe_a9d6_f02c_e0041078dadf["test_openapi_schema()"]
  107fefd2_4dff_5180_81e2_480b572b2f96["test_response_model_sub_types.py"]
  edfd00a0_dabe_a9d6_f02c_e0041078dadf -->|defined in| 107fefd2_4dff_5180_81e2_480b572b2f96
  style edfd00a0_dabe_a9d6_f02c_e0041078dadf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_response_model_sub_types.py lines 48–161

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": {
                "/valid1": {
                    "get": {
                        "summary": "Valid1",
                        "operationId": "valid1_valid1_get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "500": {
                                "description": "Internal Server Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "title": "Response 500 Valid1 Valid1 Get",
                                            "type": "integer",
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/valid2": {
                    "get": {
                        "summary": "Valid2",
                        "operationId": "valid2_valid2_get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "500": {
                                "description": "Internal Server Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "title": "Response 500 Valid2 Valid2 Get",
                                            "type": "array",
                                            "items": {"type": "integer"},
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/valid3": {
                    "get": {
                        "summary": "Valid3",
                        "operationId": "valid3_valid3_get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "500": {
                                "description": "Internal Server Error",
                                "content": {
                                    "application/json": {
                                        "schema": {"$ref": "#/components/schemas/Model"}
                                    }
                                },
                            },
                        },
                    }
                },
                "/valid4": {
                    "get": {
                        "summary": "Valid4",
                        "operationId": "valid4_valid4_get",
                        "responses": {
                            "200": {

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_response_model_sub_types.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_response_model_sub_types.py at line 48.

Analyze Your Own Codebase

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

Try Supermodel Free