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_router.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  f9bd9634_54ee_8c51_7077_00307052cfda["test_openapi_schema()"]
  812a9221_f647_2bc8_2370_086ac079c8be["test_additional_responses_router.py"]
  f9bd9634_54ee_8c51_7077_00307052cfda -->|defined in| 812a9221_f647_2bc8_2370_086ac079c8be
  style f9bd9634_54ee_8c51_7077_00307052cfda fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_additional_responses_router.py lines 85–182

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": {
                            "501": {"description": "Error 1"},
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                        },
                        "summary": "A",
                        "operationId": "a_a_get",
                    }
                },
                "/b": {
                    "get": {
                        "responses": {
                            "502": {"description": "Error 2"},
                            "4XX": {"description": "Error with range, upper"},
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                        },
                        "summary": "B",
                        "operationId": "b_b_get",
                    }
                },
                "/c": {
                    "get": {
                        "responses": {
                            "400": {"description": "Error with str"},
                            "5XX": {"description": "Error with range, lower"},
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "default": {"description": "A default response"},
                        },
                        "summary": "C",
                        "operationId": "c_c_get",
                    }
                },
                "/d": {
                    "get": {
                        "responses": {
                            "400": {"description": "Error with str"},
                            "5XX": {
                                "description": "Server Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/ResponseModel"
                                        }
                                    }
                                },
                            },
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "default": {
                                "description": "Default Response",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/ResponseModel"
                                        }
                                    }
                                },
                            },
                        },
                        "summary": "D",
                        "operationId": "d_d_get",

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_router.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_additional_responses_router.py at line 85.

Analyze Your Own Codebase

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

Try Supermodel Free