Home / Function/ test_openapi() — fastapi Function Reference

test_openapi() — fastapi Function Reference

Architecture documentation for the test_openapi() function in test_openapi_query_parameter_extension.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  540213f8_e84f_7b89_76ca_ccba0d3d31ee["test_openapi()"]
  8335af8b_0951_5d32_a19a_3d06c10fb47b["test_openapi_query_parameter_extension.py"]
  540213f8_e84f_7b89_76ca_ccba0d3d31ee -->|defined in| 8335af8b_0951_5d32_a19a_3d06c10fb47b
  style 540213f8_e84f_7b89_76ca_ccba0d3d31ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_openapi_query_parameter_extension.py lines 42–133

def test_openapi():
    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": "Route With Extra Query Parameters",
                        "operationId": "route_with_extra_query_parameters__get",
                        "parameters": [
                            {
                                "required": False,
                                "schema": {
                                    "anyOf": [{"type": "integer"}, {"type": "null"}],
                                    "default": 50,
                                    "title": "Standard Query Param",
                                },
                                "name": "standard_query_param",
                                "in": "query",
                            },
                            {
                                "required": False,
                                "schema": {"title": "Extra Param 1"},
                                "name": "extra_param_1",
                                "in": "query",
                            },
                            {
                                "required": True,
                                "schema": {"title": "Extra Param 2"},
                                "name": "extra_param_2",
                                "in": "query",
                            },
                        ],
                        "responses": {
                            "200": {
                                "description": "Successful Response",
                                "content": {"application/json": {"schema": {}}},
                            },
                            "422": {
                                "description": "Validation Error",
                                "content": {
                                    "application/json": {
                                        "schema": {
                                            "$ref": "#/components/schemas/HTTPValidationError"
                                        }
                                    }
                                },
                            },
                        },
                    }
                }
            },
            "components": {
                "schemas": {
                    "HTTPValidationError": {
                        "title": "HTTPValidationError",
                        "type": "object",
                        "properties": {
                            "detail": {
                                "title": "Detail",
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/ValidationError"
                                },
                            }
                        },
                    },
                    "ValidationError": {
                        "title": "ValidationError",
                        "required": ["loc", "msg", "type"],
                        "type": "object",
                        "properties": {
                            "loc": {
                                "title": "Location",
                                "type": "array",
                                "items": {
                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
                                },

Domain

Subdomains

Frequently Asked Questions

What does test_openapi() do?
test_openapi() is a function in the fastapi codebase, defined in tests/test_openapi_query_parameter_extension.py.
Where is test_openapi() defined?
test_openapi() is defined in tests/test_openapi_query_parameter_extension.py at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free