Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2b829a34_e232_72c2_115b_e4f1ff65a1ee["test_openapi_schema()"]
  eb102b62_f4e8_8f47_de84_f7b446fa16b3["test_main.py"]
  2b829a34_e232_72c2_115b_e4f1ff65a1ee -->|defined in| eb102b62_f4e8_8f47_de84_f7b446fa16b3
  style 2b829a34_e232_72c2_115b_e4f1ff65a1ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_tutorial/test_bigger_applications/test_main.py lines 270–607

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": {
                "/users/": {
                    "get": {
                        "tags": ["users"],
                        "summary": "Read Users",
                        "operationId": "read_users_users__get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Token", "type": "string"},
                                "name": "token",
                                "in": "query",
                            }
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/users/me": {
                    "get": {
                        "tags": ["users"],
                        "summary": "Read User Me",
                        "operationId": "read_user_me_users_me_get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Token", "type": "string"},
                                "name": "token",
                                "in": "query",
                            }
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/users/{username}": {
                    "get": {
                        "tags": ["users"],
                        "summary": "Read User",
                        "operationId": "read_user_users__username__get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Username", "type": "string"},
                                "name": "username",
                                "in": "path",

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_bigger_applications/test_main.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_tutorial/test_bigger_applications/test_main.py at line 270.

Analyze Your Own Codebase

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

Try Supermodel Free