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

Entity Profile

Dependency Diagram

graph TD
  8f42750f_6e58_2d69_ac2c_af5f41f6d545["test_openapi_schema()"]
  1f92429c_3e8b_7f2a_e7a3_71eba8fe1fbd["test_additional_properties_bool.py"]
  8f42750f_6e58_2d69_ac2c_af5f41f6d545 -->|defined in| 1f92429c_3e8b_7f2a_e7a3_71eba8fe1fbd
  style 8f42750f_6e58_2d69_ac2c_af5f41f6d545 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_additional_properties_bool.py lines 41–127

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": "Post",
                        "operationId": "post__post",
                        "requestBody": {
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "anyOf": [
                                            {"$ref": "#/components/schemas/Foo"},
                                            {"type": "null"},
                                        ],
                                        "title": "Foo",
                                    }
                                }
                            }
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                }
            },
            "components": {
                "schemas": {
                    "Foo": {
                        "properties": {},
                        "additionalProperties": False,
                        "type": "object",
                        "title": "Foo",
                    },
                    "HTTPValidationError": {
                        "properties": {
                            "detail": {
                                "items": {
                                    "$ref": "#/components/schemas/ValidationError"
                                },
                                "type": "array",
                                "title": "Detail",
                            }
                        },
                        "type": "object",
                        "title": "HTTPValidationError",
                    },
                    "ValidationError": {
                        "properties": {
                            "ctx": {"title": "Context", "type": "object"},
                            "input": {"title": "Input"},
                            "loc": {
                                "items": {
                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
                                },
                                "type": "array",
                                "title": "Location",
                            },
                            "msg": {"type": "string", "title": "Message"},
                            "type": {"type": "string", "title": "Error Type"},
                        },
                        "type": "object",
                        "required": ["loc", "msg", "type"],

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_properties_bool.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_additional_properties_bool.py at line 41.

Analyze Your Own Codebase

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

Try Supermodel Free