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_authorization_code_bearer_scopes_openapi.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  321df5c3_137e_70e2_bccc_d72a5990895f["test_openapi_schema()"]
  07370cbc_9a3c_ae5f_2d85_610944db9a0b["test_security_oauth2_authorization_code_bearer_scopes_openapi.py"]
  321df5c3_137e_70e2_bccc_d72a5990895f -->|defined in| 07370cbc_9a3c_ae5f_2d85_610944db9a0b
  style 321df5c3_137e_70e2_bccc_d72a5990895f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py lines 99–197

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": {
                "/": {
                    "get": {
                        "summary": "Root",
                        "operationId": "root__get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "security": [{"OAuth2AuthorizationCodeBearer": []}],
                    }
                },
                "/with-oauth2-scheme": {
                    "get": {
                        "summary": "Read With Oauth2 Scheme",
                        "operationId": "read_with_oauth2_scheme_with_oauth2_scheme_get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "security": [
                            {"OAuth2AuthorizationCodeBearer": ["read", "write"]}
                        ],
                    }
                },
                "/with-get-token": {
                    "get": {
                        "summary": "Read With Get Token",
                        "operationId": "read_with_get_token_with_get_token_get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "security": [
                            {"OAuth2AuthorizationCodeBearer": ["read", "write"]}
                        ],
                    }
                },
                "/items/": {
                    "get": {
                        "summary": "Read Items",
                        "operationId": "read_items_items__get",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "security": [
                            {"OAuth2AuthorizationCodeBearer": ["read"]},
                        ],
                    },
                    "post": {
                        "summary": "Create Item",
                        "operationId": "create_item_items__post",
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            }
                        },
                        "security": [
                            {"OAuth2AuthorizationCodeBearer": ["read", "write"]},
                        ],
                    },
                },
            },
            "components": {

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_authorization_code_bearer_scopes_openapi.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py at line 99.

Analyze Your Own Codebase

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

Try Supermodel Free