Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_sub_callbacks.py lines 87–308

def test_openapi_schema():
    with client:
        response = client.get("/openapi.json")
        assert response.json() == snapshot(
            {
                "openapi": "3.1.0",
                "info": {"title": "FastAPI", "version": "0.1.0"},
                "paths": {
                    "/invoices/": {
                        "post": {
                            "summary": "Create Invoice",
                            "description": 'Create an invoice.\n\nThis will (let\'s imagine) let the API user (some external developer) create an\ninvoice.\n\nAnd this path operation will:\n\n* Send the invoice to the client.\n* Collect the money from the client.\n* Send a notification back to the API user (the external developer), as a callback.\n    * At this point is that the API will somehow send a POST request to the\n        external API with the notification of the invoice event\n        (e.g. "payment successful").',
                            "operationId": "create_invoice_invoices__post",
                            "parameters": [
                                {
                                    "required": False,
                                    "schema": {
                                        "title": "Callback Url",
                                        "anyOf": [
                                            {
                                                "type": "string",
                                                "format": "uri",
                                                "minLength": 1,
                                                "maxLength": 2083,
                                            },
                                            {"type": "null"},
                                        ],
                                    },
                                    "name": "callback_url",
                                    "in": "query",
                                }
                            ],
                            "requestBody": {
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/Invoice"
                                        }
                                    }
                                },
                                "required": True,
                            },
                            "responses": {
                                "200": {
                                    "description": "Successful Response",
                                    "content": {"application/json": {"schema": {}}},
                                },
                                "422": {
                                    "description": "Validation Error",
                                    "content": {
                                        "application/json": {
                                            "schema": {
                                                "$ref": "#/components/schemas/HTTPValidationError"
                                            }
                                        }
                                    },
                                },
                            },
                            "callbacks": {
                                "event_callback": {
                                    "{$callback_url}/events/{$request.body.title}": {
                                        "get": {
                                            "summary": "Event Callback",
                                            "operationId": "event_callback__callback_url__events___request_body_title__get",
                                            "requestBody": {
                                                "required": True,
                                                "content": {
                                                    "application/json": {
                                                        "schema": {
                                                            "$ref": "#/components/schemas/Event"
                                                        }
                                                    }
                                                },
                                            },
                                            "responses": {
                                                "200": {
                                                    "description": "Successful Response",
                                                    "content": {
                                                        "application/json": {
                                                            "schema": {}
                                                        }

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_sub_callbacks.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_sub_callbacks.py at line 87.

Analyze Your Own Codebase

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

Try Supermodel Free