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

Entity Profile

Dependency Diagram

graph TD
  290d8a91_8554_6b90_6d37_6a283f209f1a["test_openapi_schema()"]
  dfff6014_f006_aa5d_29b9_ef946d567ce4["test_additional_responses_custom_validationerror.py"]
  290d8a91_8554_6b90_6d37_6a283f209f1a -->|defined in| dfff6014_f006_aa5d_29b9_ef946d567ce4
  style 290d8a91_8554_6b90_6d37_6a283f209f1a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_additional_responses_custom_validationerror.py lines 35–100

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/{id}": {
                    "get": {
                        "responses": {
                            "422": {
                                "description": "Error",
                                "content": {
                                    "application/vnd.api+json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/JsonApiError"
                                        }
                                    }
                                },
                            },
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/vnd.api+json": {"schema": {}}},
                            },
                        },
                        "summary": "A",
                        "operationId": "a_a__id__get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Id"},
                                "name": "id",
                                "in": "path",
                            }
                        ],
                    }
                }
            },
            "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_additional_responses_custom_validationerror.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_additional_responses_custom_validationerror.py at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free