Home / Function/ test_openapi_schema() — fastapi Function Reference

test_openapi_schema() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0794b424_ae5e_b50f_bf69_2ca831393d18["test_openapi_schema()"]
  9eed5ce0_eb37_cec8_53d3_c799539dd3c5["test_forms_single_param.py"]
  0794b424_ae5e_b50f_bf69_2ca831393d18 -->|defined in| 9eed5ce0_eb37_cec8_53d3_c799539dd3c5
  style 0794b424_ae5e_b50f_bf69_2ca831393d18 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_forms_single_param.py lines 24–109

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": {
                "/form/": {
                    "post": {
                        "summary": "Post Form",
                        "operationId": "post_form_form__post",
                        "requestBody": {
                            "content": {
                                "application/x-www-form-urlencoded": {
                                    "schema": {
                                        "$ref": "#/components/schemas/Body_post_form_form__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_post_form_form__post": {
                        "properties": {
                            "username": {"type": "string", "title": "Username"}
                        },
                        "type": "object",
                        "required": ["username"],
                        "title": "Body_post_form_form__post",
                    },
                    "HTTPValidationError": {
                        "properties": {
                            "detail": {
                                "items": {
                                    "$ref": "#/components/schemas/ValidationError"
                                },
                                "type": "array",
                                "title": "Detail",
                            }
                        },
                        "type": "object",
                        "title": "HTTPValidationError",
                    },
                    "ValidationError": {
                        "properties": {
                            "ctx": {"title": "Context", "type": "object"},
                            "input": {"title": "Input"},
                            "loc": {
                                "items": {
                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
                                },
                                "type": "array",
                                "title": "Location",
                            },
                            "msg": {"type": "string", "title": "Message"},
                            "type": {"type": "string", "title": "Error Type"},
                        },
                        "type": "object",
                        "required": ["loc", "msg", "type"],
                        "title": "ValidationError",

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_forms_single_param.py.
Where is test_openapi_schema() defined?
test_openapi_schema() is defined in tests/test_forms_single_param.py at line 24.

Analyze Your Own Codebase

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

Try Supermodel Free