Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  70d58edc_27cc_98b5_fe7e_62933d76dc48["test_openapi_schema()"]
  b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6["test_no_schema_split.py"]
  70d58edc_27cc_98b5_fe7e_62933d76dc48 -->|defined in| b56890d6_fe1a_8fde_5dcf_cb5f01eeefe6
  style 70d58edc_27cc_98b5_fe7e_62933d76dc48 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_no_schema_split.py lines 56–176

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": "Minimal FastAPI App", "version": "1.0.0"},
            "paths": {
                "/messages": {
                    "post": {
                        "summary": "Create Message",
                        "operationId": "create_message_messages_post",
                        "parameters": [
                            {
                                "name": "input_message",
                                "in": "query",
                                "required": True,
                                "schema": {"type": "string", "title": "Input Message"},
                            }
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/Message"
                                        }
                                    }
                                },
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                }
            },
            "components": {
                "schemas": {
                    "HTTPValidationError": {
                        "properties": {
                            "detail": {
                                "items": {
                                    "$ref": "#/components/schemas/ValidationError"
                                },
                                "type": "array",
                                "title": "Detail",
                            }
                        },
                        "type": "object",
                        "title": "HTTPValidationError",
                    },
                    "Message": {
                        "properties": {
                            "input": {"type": "string", "title": "Input"},
                            "output": {"$ref": "#/components/schemas/MessageOutput"},
                        },
                        "type": "object",
                        "required": ["input", "output"],
                        "title": "Message",
                    },
                    "MessageEvent": {
                        "properties": {
                            "event_type": {
                                "$ref": "#/components/schemas/MessageEventType",
                                "default": "alpha",
                            },
                            "output": {"type": "string", "title": "Output"},
                        },
                        "type": "object",
                        "required": ["output"],
                        "title": "MessageEvent",
                    },

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_no_schema_split.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_no_schema_split.py at line 56.

Analyze Your Own Codebase

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

Try Supermodel Free