Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  27999877_2288_d66a_c01a_ad090e61b050["test_openapi_schema()"]
  de016fd2_677f_58c6_647d_bd16836e0b35["test_additional_responses_response_class.py"]
  27999877_2288_d66a_c01a_ad090e61b050 -->|defined in| de016fd2_677f_58c6_647d_bd16836e0b35
  style 27999877_2288_d66a_c01a_ad090e61b050 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_additional_responses_response_class.py lines 40–117

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": {
                "/a": {
                    "get": {
                        "responses": {
                            "500": {
                                "description": "Error",
                                "content": {
                                    "application/vnd.api+json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/JsonApiError"
                                        }
                                    }
                                },
                            },
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/vnd.api+json": {"schema": {}}},
                            },
                        },
                        "summary": "A",
                        "operationId": "a_a_get",
                    }
                },
                "/b": {
                    "get": {
                        "responses": {
                            "500": {
                                "description": "Error",
                                "content": {
                                    "application/json": {
                                        "schema": {"$ref": "#/components/schemas/Error"}
                                    }
                                },
                            },
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                        },
                        "summary": "B",
                        "operationId": "b_b_get",
                    }
                },
            },
            "components": {
                "schemas": {
                    "Error": {
                        "title": "Error",
                        "required": ["status", "title"],
                        "type": "object",
                        "properties": {
                            "status": {"title": "Status", "type": "string"},
                            "title": {"title": "Title", "type": "string"},
                        },
                    },
                    "JsonApiError": {
                        "title": "JsonApiError",
                        "required": ["errors"],
                        "type": "object",
                        "properties": {
                            "errors": {
                                "title": "Errors",
                                "type": "array",
                                "items": {"$ref": "#/components/schemas/Error"},
                            }
                        },
                    },
                }
            },
        }
    )

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_additional_responses_response_class.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_additional_responses_response_class.py at line 40.

Analyze Your Own Codebase

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

Try Supermodel Free