Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  cfc19d87_3eda_81d4_af76_c358a983ded3["test_openapi_schema()"]
  6123fefa_c781_dadf_e8c4_f49c54b860f0["test_security_oauth2_password_bearer_optional.py"]
  cfc19d87_3eda_81d4_af76_c358a983ded3 -->|defined in| 6123fefa_c781_dadf_e8c4_f49c54b860f0
  style cfc19d87_3eda_81d4_af76_c358a983ded3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_security_oauth2_password_bearer_optional.py lines 41–72

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": {
                "/items/": {
                    "get": {
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "summary": "Read Items",
                        "operationId": "read_items_items__get",
                        "security": [{"OAuth2PasswordBearer": []}],
                    }
                }
            },
            "components": {
                "securitySchemes": {
                    "OAuth2PasswordBearer": {
                        "type": "oauth2",
                        "flows": {"password": {"scopes": {}, "tokenUrl": "/token"}},
                    }
                }
            },
        }
    )

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

Analyze Your Own Codebase

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

Try Supermodel Free