Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6bbc4254_0d59_1ebd_5a97_b3b160fa5b9a["test_openapi_schema()"]
  a06efdcd_88e1_9da7_ff53_2050c02705ed["test_tutorial001.py"]
  6bbc4254_0d59_1ebd_5a97_b3b160fa5b9a -->|defined in| a06efdcd_88e1_9da7_ff53_2050c02705ed
  style 6bbc4254_0d59_1ebd_5a97_b3b160fa5b9a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_extra_data_types/test_tutorial001.py lines 47–165

def test_openapi_schema(client: TestClient):
    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": {
                "/items/{item_id}": {
                    "put": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                        "summary": "Read Items",
                        "operationId": "read_items_items__item_id__put",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {
                                    "title": "Item Id",
                                    "type": "string",
                                    "format": "uuid",
                                },
                                "name": "item_id",
                                "in": "path",
                            }
                        ],
                        "requestBody": {
                            "required": True,
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Body_read_items_items__item_id__put"
                                    }
                                }
                            },
                        },
                    }
                }
            },
            "components": {
                "schemas": {
                    "Body_read_items_items__item_id__put": {
                        "title": "Body_read_items_items__item_id__put",
                        "type": "object",
                        "properties": {
                            "start_datetime": {
                                "title": "Start Datetime",
                                "type": "string",
                                "format": "date-time",
                            },
                            "end_datetime": {
                                "title": "End Datetime",
                                "type": "string",
                                "format": "date-time",
                            },
                            "repeat_at": {
                                "title": "Repeat At",
                                "anyOf": [
                                    {"type": "string", "format": "time"},
                                    {"type": "null"},
                                ],
                            },
                            "process_after": {
                                "title": "Process After",
                                "type": "string",
                                "format": "duration",
                            },

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_tutorial/test_extra_data_types/test_tutorial001.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_tutorial/test_extra_data_types/test_tutorial001.py at line 47.

Analyze Your Own Codebase

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

Try Supermodel Free