Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0cc198e4_5b4b_d4b1_1e92_eb7037fa94b7["test_openapi_schema()"]
  869096b5_7189_9202_7052_8e630d9bb7b3["test_response_code_no_body.py"]
  0cc198e4_5b4b_d4b1_1e92_eb7037fa94b7 -->|defined in| 869096b5_7189_9202_7052_8e630d9bb7b3
  style 0cc198e4_5b4b_d4b1_1e92_eb7037fa94b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_response_code_no_body.py lines 48–115

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": {
                "/a": {
                    "get": {
                        "responses": {
                            "500": {
                                "description": "Error",
                                "content": {
                                    "application/vnd.api+json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/JsonApiError"
                                        }
                                    }
                                },
                            },
                            "204": {"description": "Successful Response"},
                        },
                        "summary": "A",
                        "operationId": "a_a_get",
                    }
                },
                "/b": {
                    "get": {
                        "responses": {
                            "204": {"description": "No Content"},
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                        },
                        "summary": "B",
                        "operationId": "b_b_get",
                    }
                },
            },
            "components": {
                "schemas": {
                    "Error": {
                        "title": "Error",
                        "required": ["status", "title"],
                        "type": "object",
                        "properties": {
                            "status": {"title": "Status", "type": "string"},
                            "title": {"title": "Title", "type": "string"},
                        },
                    },
                    "JsonApiError": {
                        "title": "JsonApiError",
                        "required": ["errors"],
                        "type": "object",
                        "properties": {
                            "errors": {
                                "title": "Errors",
                                "type": "array",
                                "items": {"$ref": "#/components/schemas/Error"},
                            }
                        },
                    },
                }
            },
        }
    )

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_response_code_no_body.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_response_code_no_body.py at line 48.

Analyze Your Own Codebase

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

Try Supermodel Free