Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3872360a_d299_e03e_de46_71291f72d1e6["test_openapi_schema()"]
  9ddbfdd1_7392_6722_db09_7324223655a8["test_application.py"]
  3872360a_d299_e03e_de46_71291f72d1e6 -->|defined in| 9ddbfdd1_7392_6722_db09_7324223655a8
  style 3872360a_d299_e03e_de46_71291f72d1e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_application.py lines 55–1285

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"},
            "externalDocs": {
                "description": "External API documentation.",
                "url": "https://docs.example.com/api-general",
            },
            "paths": {
                "/api_route": {
                    "get": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "summary": "Non Operation",
                        "operationId": "non_operation_api_route_get",
                    }
                },
                "/non_decorated_route": {
                    "get": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "summary": "Non Decorated Route",
                        "operationId": "non_decorated_route_non_decorated_route_get",
                    }
                },
                "/text": {
                    "get": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "summary": "Get Text",
                        "operationId": "get_text_text_get",
                    }
                },
                "/path/{item_id}": {
                    "get": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                        "summary": "Get Id",
                        "operationId": "get_id_path__item_id__get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Item Id"},
                                "name": "item_id",
                                "in": "path",
                            }
                        ],
                    }
                },
                "/path/str/{item_id}": {
                    "get": {
                        "responses": {

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_application.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_application.py at line 55.

Analyze Your Own Codebase

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

Try Supermodel Free