Home / Function/ test_openapi() — fastapi Function Reference

test_openapi() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a827e927_778d_fed4_e812_cda240c458ea["test_openapi()"]
  8a65c19d_019a_1399_fa06_1485151414b4["test_tutorial001.py"]
  a827e927_778d_fed4_e812_cda240c458ea -->|defined in| 8a65c19d_019a_1399_fa06_1485151414b4
  style a827e927_778d_fed4_e812_cda240c458ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_using_request_directly/test_tutorial001.py lines 15–117

def test_openapi():
    response = client.get("/openapi.json")
    assert response.status_code == 200
    assert response.json() == snapshot(
        {
            "info": {
                "title": "FastAPI",
                "version": "0.1.0",
            },
            "openapi": "3.1.0",
            "paths": {
                "/items/{item_id}": {
                    "get": {
                        "operationId": "read_root_items__item_id__get",
                        "parameters": [
                            {
                                "in": "path",
                                "name": "item_id",
                                "required": True,
                                "schema": {
                                    "title": "Item Id",
                                    "type": "string",
                                },
                            },
                        ],
                        "responses": {
                            "200": {
                                "content": {
                                    "application/json": {
                                        "schema": {},
                                    },
                                },
                                "description": "Successful Response",
                            },
                            "422": {
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError",
                                        },
                                    },
                                },
                                "description": "Validation Error",
                            },
                        },
                        "summary": "Read Root",
                    },
                },
            },
            "components": {
                "schemas": {
                    "HTTPValidationError": {
                        "properties": {
                            "detail": {
                                "items": {
                                    "$ref": "#/components/schemas/ValidationError",
                                },
                                "title": "Detail",
                                "type": "array",
                            },
                        },
                        "title": "HTTPValidationError",
                        "type": "object",
                    },
                    "ValidationError": {
                        "properties": {
                            "ctx": {"title": "Context", "type": "object"},
                            "input": {"title": "Input"},
                            "loc": {
                                "items": {
                                    "anyOf": [
                                        {
                                            "type": "string",
                                        },
                                        {
                                            "type": "integer",
                                        },
                                    ],
                                },
                                "title": "Location",
                                "type": "array",

Domain

Subdomains

Frequently Asked Questions

What does test_openapi() do?
test_openapi() is a function in the fastapi codebase, defined in tests/test_tutorial/test_using_request_directly/test_tutorial001.py.
Where is test_openapi() defined?
test_openapi() is defined in tests/test_tutorial/test_using_request_directly/test_tutorial001.py at line 15.

Analyze Your Own Codebase

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

Try Supermodel Free