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

Entity Profile

Dependency Diagram

graph TD
  a13b4e9b_0d0a_3f7d_9492_efe1627e929e["test_openapi_schema()"]
  f94fef85_5440_ee04_de4b_91d40adf6f11["test_additional_responses_custom_model_in_callback.py"]
  a13b4e9b_0d0a_3f7d_9492_efe1627e929e -->|defined in| f94fef85_5440_ee04_de4b_91d40adf6f11
  style a13b4e9b_0d0a_3f7d_9492_efe1627e929e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_additional_responses_custom_model_in_callback.py lines 32–147

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": {
                "/": {
                    "post": {
                        "summary": "Main Route",
                        "operationId": "main_route__post",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {
                                    "title": "Callback Url",
                                    "maxLength": 2083,
                                    "minLength": 1,
                                    "type": "string",
                                    "format": "uri",
                                },
                                "name": "callback_url",
                                "in": "query",
                            }
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                        "callbacks": {
                            "callback_route": {
                                "{$callback_url}/callback/": {
                                    "get": {
                                        "summary": "Callback Route",
                                        "operationId": "callback_route__callback_url__callback__get",
                                        "responses": {
                                            "400": {
                                                "content": {
                                                    "application/json": {
                                                        "schema": {
                                                            "$ref": "#/components/schemas/CustomModel"
                                                        }
                                                    }
                                                },
                                                "description": "Bad Request",
                                            },
                                            "200": {
                                                "description": "Successful Response",
                                                "content": {
                                                    "application/json": {"schema": {}}
                                                },
                                            },
                                        },
                                    }
                                }
                            }
                        },
                    }
                }
            },
            "components": {
                "schemas": {
                    "CustomModel": {
                        "title": "CustomModel",
                        "required": ["a"],
                        "type": "object",
                        "properties": {"a": {"title": "A", "type": "integer"}},
                    },

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_custom_model_in_callback.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_additional_responses_custom_model_in_callback.py at line 32.

Analyze Your Own Codebase

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

Try Supermodel Free