Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  fc479f0c_d7f3_523a_5ac1_997153f6dc81["test_openapi_schema()"]
  ecc1f57b_9ed7_2e84_303f_5f43516bb6a7["test_request_body_parameters_media_type.py"]
  fc479f0c_d7f3_523a_5ac1_997153f6dc81 -->|defined in| ecc1f57b_9ed7_2e84_303f_5f43516bb6a7
  style fc479f0c_d7f3_523a_5ac1_997153f6dc81 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_request_body_parameters_media_type.py lines 38–184

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": {
                "/products": {
                    "post": {
                        "summary": "Create Product",
                        "operationId": "create_product_products_post",
                        "requestBody": {
                            "content": {
                                "application/vnd.api+json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Body_create_product_products_post"
                                    }
                                }
                            },
                            "required": True,
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
                "/shops": {
                    "post": {
                        "summary": "Create Shop",
                        "operationId": "create_shop_shops_post",
                        "requestBody": {
                            "content": {
                                "application/vnd.api+json": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Body_create_shop_shops_post"
                                    }
                                }
                            },
                            "required": True,
                        },
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                },
            },
            "components": {
                "schemas": {
                    "Body_create_product_products_post": {
                        "title": "Body_create_product_products_post",
                        "required": ["data"],
                        "type": "object",
                        "properties": {
                            "data": {"$ref": "#/components/schemas/Product"}

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_request_body_parameters_media_type.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_request_body_parameters_media_type.py at line 38.

Analyze Your Own Codebase

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

Try Supermodel Free