Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f916fd7f_28e2_3d26_1af8_2670f4f301bf["test_openapi_schema()"]
  97adeb06_a3f2_aa0f_0da8_64acee359394["test_openapi_separate_input_output_schemas.py"]
  f916fd7f_28e2_3d26_1af8_2670f4f301bf -->|defined in| 97adeb06_a3f2_aa0f_0da8_64acee359394
  c660ea81_fb98_0581_a314_dc8cb8b042bf["get_app_client()"]
  f916fd7f_28e2_3d26_1af8_2670f4f301bf -->|calls| c660ea81_fb98_0581_a314_dc8cb8b042bf
  style f916fd7f_28e2_3d26_1af8_2670f4f301bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_openapi_separate_input_output_schemas.py lines 161–440

def test_openapi_schema():
    client = get_app_client()
    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": {
                "/items/": {
                    "get": {
                        "summary": "Read Items",
                        "operationId": "read_items_items__get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "items": {
                                                "$ref": "#/components/schemas/Item-Output"
                                            },
                                            "type": "array",
                                            "title": "Response Read Items Items  Get",
                                        }
                                    }
                                },
                            }
                        },
                    },
                    "post": {
                        "summary": "Create Item",
                        "operationId": "create_item_items__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Item-Input"
                                    }
                                }
                            },
                            "required": True,
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/Item-Output"
                                        }
                                    }
                                },
                            },
                            "402": {
                                "description": "Payment Required",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/Item-Output"
                                        }
                                    }
                                },
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    },
                },
                "/items-list/": {
                    "post": {
                        "summary": "Create Item List",
                        "operationId": "create_item_list_items_list__post",

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_openapi_separate_input_output_schemas.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_openapi_separate_input_output_schemas.py at line 161.
What does test_openapi_schema() call?
test_openapi_schema() calls 1 function(s): get_app_client.

Analyze Your Own Codebase

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

Try Supermodel Free