Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6948e21a_1ab3_a7eb_1bc9_c90cb92d4856["test_openapi_schema()"]
  a7a3beeb_1196_c16a_43ea_fe877dcd5d13["test_openapi_servers.py"]
  6948e21a_1ab3_a7eb_1bc9_c90cb92d4856 -->|defined in| a7a3beeb_1196_c16a_43ea_fe877dcd5d13
  style 6948e21a_1ab3_a7eb_1bc9_c90cb92d4856 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_openapi_servers.py lines 30–60

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"},
            "servers": [
                {"url": "/", "description": "Default, relative server"},
                {
                    "url": "http://staging.localhost.tiangolo.com:8000",
                    "description": "Staging but actually localhost still",
                },
                {"url": "https://prod.example.com"},
            ],
            "paths": {
                "/foo": {
                    "get": {
                        "summary": "Foo",
                        "operationId": "foo_foo_get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                    }
                }
            },
        }
    )

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_openapi_servers.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_openapi_servers.py at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free