Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  5ebc7a17_b9b5_f1ad_0a08_4e00f3a3439d["test_openapi_schema()"]
  ebdf85eb_0692_0882_dd01_47bca11b24da["test_annotated.py"]
  5ebc7a17_b9b5_f1ad_0a08_4e00f3a3439d -->|defined in| ebdf85eb_0692_0882_dd01_47bca11b24da
  style 5ebc7a17_b9b5_f1ad_0a08_4e00f3a3439d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_annotated.py lines 121–298

def test_openapi_schema():
    response = client.get("/openapi.json")
    assert response.status_code == 200
    assert response.json() == snapshot(
        {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/default": {
                    "get": {
                        "summary": "Default",
                        "operationId": "default_default_get",
                        "parameters": [
                            {
                                "required": False,
                                "schema": {
                                    "title": "Foo",
                                    "type": "string",
                                    "default": "foo",
                                },
                                "name": "foo",
                                "in": "query",
                            }
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/required": {
                    "get": {
                        "summary": "Required",
                        "operationId": "required_required_get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {
                                    "title": "Foo",
                                    "minLength": 1,
                                    "type": "string",
                                },
                                "name": "foo",
                                "in": "query",
                            }
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/multiple": {
                    "get": {
                        "summary": "Multiple",
                        "operationId": "multiple_multiple_get",
                        "parameters": [

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_annotated.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_annotated.py at line 121.

Analyze Your Own Codebase

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

Try Supermodel Free