Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a55b6fdb_bc91_e931_a9b9_d454b23c8784["test_openapi_schema()"]
  4ac0c576_5050_038c_1ce4_ae179f977589["test_dependency_duplicates.py"]
  a55b6fdb_bc91_e931_a9b9_d454b23c8784 -->|defined in| 4ac0c576_5050_038c_1ce4_ae179f977589
  style a55b6fdb_bc91_e931_a9b9_d454b23c8784 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_dependency_duplicates.py lines 85–237

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": {
                "/with-duplicates": {
                    "post": {
                        "summary": "With Duplicates",
                        "operationId": "with_duplicates_with_duplicates_post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {"$ref": "#/components/schemas/Item"}
                                }
                            },
                            "required": True,
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/no-duplicates": {
                    "post": {
                        "summary": "No Duplicates",
                        "operationId": "no_duplicates_no_duplicates_post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Body_no_duplicates_no_duplicates_post"
                                    }
                                }
                            },
                            "required": True,
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/with-duplicates-sub": {
                    "post": {
                        "summary": "No Duplicates Sub",
                        "operationId": "no_duplicates_sub_with_duplicates_sub_post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {"$ref": "#/components/schemas/Item"}
                                }
                            },
                            "required": True,

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_dependency_duplicates.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_dependency_duplicates.py at line 85.

Analyze Your Own Codebase

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

Try Supermodel Free