]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
✅ Add inline snapshot tests for OpenAPI before changes from Pydantic v2 (#14864)
authorSebastián Ramírez <tiangolo@gmail.com>
Sun, 8 Feb 2026 10:18:38 +0000 (02:18 -0800)
committerGitHub <noreply@github.com>
Sun, 8 Feb 2026 10:18:38 +0000 (10:18 +0000)
248 files changed:
tests/test_additional_properties.py
tests/test_additional_properties_bool.py
tests/test_additional_response_extra.py
tests/test_additional_responses_custom_validationerror.py
tests/test_additional_responses_default_validationerror.py
tests/test_additional_responses_response_class.py
tests/test_additional_responses_router.py
tests/test_additional_responses_union_duplicate_anyof.py
tests/test_annotated.py
tests/test_application.py
tests/test_computed_fields.py
tests/test_custom_route_class.py
tests/test_dependency_duplicates.py
tests/test_deprecated_openapi_prefix.py
tests/test_duplicate_models_openapi.py
tests/test_enforce_once_required_parameter.py
tests/test_extra_routes.py
tests/test_forms_single_param.py
tests/test_generate_unique_id_function.py
tests/test_generic_parameterless_depends.py
tests/test_get_request_body.py
tests/test_include_router_defaults_overrides.py
tests/test_infer_param_optionality.py
tests/test_modules_same_name_body/test_main.py
tests/test_multi_body_errors.py
tests/test_multi_query_errors.py
tests/test_openapi_examples.py
tests/test_openapi_query_parameter_extension.py
tests/test_openapi_route_extensions.py
tests/test_openapi_separate_input_output_schemas.py
tests/test_param_in_path_and_dependency.py
tests/test_param_include_in_schema.py
tests/test_put_no_body.py
tests/test_regex_deprecated_params.py
tests/test_repeated_dependency_schema.py
tests/test_repeated_parameter_alias.py
tests/test_reponse_set_reponse_code_empty.py
tests/test_request_body_parameters_media_type.py
tests/test_request_params/test_cookie/test_optional_str.py
tests/test_request_params/test_cookie/test_required_str.py
tests/test_request_params/test_header/test_list.py
tests/test_request_params/test_header/test_optional_list.py
tests/test_request_params/test_header/test_optional_str.py
tests/test_request_params/test_header/test_required_str.py
tests/test_request_params/test_path/test_required_str.py
tests/test_request_params/test_query/test_list.py
tests/test_request_params/test_query/test_optional_list.py
tests/test_request_params/test_query/test_optional_str.py
tests/test_request_params/test_query/test_required_str.py
tests/test_response_by_alias.py
tests/test_response_class_no_mediatype.py
tests/test_response_code_no_body.py
tests/test_response_model_as_return_annotation.py
tests/test_response_model_sub_types.py
tests/test_schema_extra_examples.py
tests/test_security_api_key_cookie.py
tests/test_security_api_key_cookie_description.py
tests/test_security_api_key_cookie_optional.py
tests/test_security_api_key_header.py
tests/test_security_api_key_header_description.py
tests/test_security_api_key_header_optional.py
tests/test_security_api_key_query.py
tests/test_security_api_key_query_description.py
tests/test_security_api_key_query_optional.py
tests/test_security_http_base.py
tests/test_security_http_base_description.py
tests/test_security_http_base_optional.py
tests/test_security_http_basic_optional.py
tests/test_security_http_basic_realm.py
tests/test_security_http_basic_realm_description.py
tests/test_security_http_bearer.py
tests/test_security_http_bearer_description.py
tests/test_security_http_bearer_optional.py
tests/test_security_http_digest.py
tests/test_security_http_digest_description.py
tests/test_security_http_digest_optional.py
tests/test_security_oauth2.py
tests/test_security_oauth2_authorization_code_bearer.py
tests/test_security_oauth2_authorization_code_bearer_description.py
tests/test_security_oauth2_optional.py
tests/test_security_oauth2_optional_description.py
tests/test_security_oauth2_password_bearer_optional.py
tests/test_security_oauth2_password_bearer_optional_description.py
tests/test_security_openid_connect.py
tests/test_security_openid_connect_description.py
tests/test_security_openid_connect_optional.py
tests/test_starlette_exception.py
tests/test_sub_callbacks.py
tests/test_tuples.py
tests/test_tutorial/test_additional_responses/test_tutorial001.py
tests/test_tutorial/test_additional_responses/test_tutorial002.py
tests/test_tutorial/test_additional_responses/test_tutorial003.py
tests/test_tutorial/test_additional_responses/test_tutorial004.py
tests/test_tutorial/test_behind_a_proxy/test_tutorial001.py
tests/test_tutorial/test_behind_a_proxy/test_tutorial002.py
tests/test_tutorial/test_bigger_applications/test_main.py
tests/test_tutorial/test_body/test_tutorial001.py
tests/test_tutorial/test_body/test_tutorial002.py
tests/test_tutorial/test_body/test_tutorial003.py
tests/test_tutorial/test_body/test_tutorial004.py
tests/test_tutorial/test_body_fields/test_tutorial001.py
tests/test_tutorial/test_body_multiple_params/test_tutorial001.py
tests/test_tutorial/test_body_multiple_params/test_tutorial002.py
tests/test_tutorial/test_body_multiple_params/test_tutorial003.py
tests/test_tutorial/test_body_multiple_params/test_tutorial004.py
tests/test_tutorial/test_body_multiple_params/test_tutorial005.py
tests/test_tutorial/test_body_nested_models/test_tutorial001_tutorial002_tutorial003.py
tests/test_tutorial/test_body_nested_models/test_tutorial004.py
tests/test_tutorial/test_body_nested_models/test_tutorial005.py
tests/test_tutorial/test_body_nested_models/test_tutorial006.py
tests/test_tutorial/test_body_nested_models/test_tutorial007.py
tests/test_tutorial/test_body_nested_models/test_tutorial008.py
tests/test_tutorial/test_body_nested_models/test_tutorial009.py
tests/test_tutorial/test_body_updates/test_tutorial001.py
tests/test_tutorial/test_body_updates/test_tutorial002.py
tests/test_tutorial/test_conditional_openapi/test_tutorial001.py
tests/test_tutorial/test_cookie_params/test_tutorial001.py
tests/test_tutorial/test_custom_response/test_tutorial001.py
tests/test_tutorial/test_custom_response/test_tutorial001b.py
tests/test_tutorial/test_custom_response/test_tutorial002_tutorial003_tutorial004.py
tests/test_tutorial/test_custom_response/test_tutorial005.py
tests/test_tutorial/test_custom_response/test_tutorial006.py
tests/test_tutorial/test_custom_response/test_tutorial006b.py
tests/test_tutorial/test_custom_response/test_tutorial006c.py
tests/test_tutorial/test_dataclasses/test_tutorial001.py
tests/test_tutorial/test_dataclasses/test_tutorial003.py
tests/test_tutorial/test_debugging/test_tutorial001.py
tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py
tests/test_tutorial/test_dependencies/test_tutorial002_tutorial003_tutorial004.py
tests/test_tutorial/test_dependencies/test_tutorial005.py
tests/test_tutorial/test_dependencies/test_tutorial006.py
tests/test_tutorial/test_dependencies/test_tutorial011.py
tests/test_tutorial/test_dependencies/test_tutorial012.py
tests/test_tutorial/test_encoder/test_tutorial001.py
tests/test_tutorial/test_events/test_tutorial001.py
tests/test_tutorial/test_events/test_tutorial002.py
tests/test_tutorial/test_events/test_tutorial003.py
tests/test_tutorial/test_extending_openapi/test_tutorial001.py
tests/test_tutorial/test_extra_models/test_tutorial001_tutorial002.py
tests/test_tutorial/test_extra_models/test_tutorial004.py
tests/test_tutorial/test_extra_models/test_tutorial005.py
tests/test_tutorial/test_first_steps/test_tutorial001_tutorial002_tutorial003.py
tests/test_tutorial/test_generate_clients/test_tutorial001.py
tests/test_tutorial/test_generate_clients/test_tutorial002.py
tests/test_tutorial/test_generate_clients/test_tutorial003.py
tests/test_tutorial/test_generate_clients/test_tutorial004.py
tests/test_tutorial/test_graphql/test_tutorial001.py
tests/test_tutorial/test_handling_errors/test_tutorial001.py
tests/test_tutorial/test_handling_errors/test_tutorial002.py
tests/test_tutorial/test_handling_errors/test_tutorial003.py
tests/test_tutorial/test_handling_errors/test_tutorial004.py
tests/test_tutorial/test_handling_errors/test_tutorial005.py
tests/test_tutorial/test_handling_errors/test_tutorial006.py
tests/test_tutorial/test_header_params/test_tutorial001.py
tests/test_tutorial/test_header_params/test_tutorial002.py
tests/test_tutorial/test_header_params/test_tutorial003.py
tests/test_tutorial/test_metadata/test_tutorial001.py
tests/test_tutorial/test_metadata/test_tutorial001_1.py
tests/test_tutorial/test_metadata/test_tutorial002.py
tests/test_tutorial/test_metadata/test_tutorial003.py
tests/test_tutorial/test_metadata/test_tutorial004.py
tests/test_tutorial/test_middleware/test_tutorial001.py
tests/test_tutorial/test_openapi_callbacks/test_tutorial001.py
tests/test_tutorial/test_openapi_webhooks/test_tutorial001.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial001.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial002.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial003.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial004.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial005.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial006.py
tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial007.py
tests/test_tutorial/test_path_operation_configurations/test_tutorial001.py
tests/test_tutorial/test_path_operation_configurations/test_tutorial002.py
tests/test_tutorial/test_path_operation_configurations/test_tutorial002b.py
tests/test_tutorial/test_path_operation_configurations/test_tutorial003_tutorial004.py
tests/test_tutorial/test_path_operation_configurations/test_tutorial005.py
tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py
tests/test_tutorial/test_path_params/test_tutorial001.py
tests/test_tutorial/test_path_params/test_tutorial002.py
tests/test_tutorial/test_path_params/test_tutorial003.py
tests/test_tutorial/test_path_params/test_tutorial003b.py
tests/test_tutorial/test_path_params/test_tutorial004.py
tests/test_tutorial/test_path_params/test_tutorial005.py
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial001.py
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial002_tutorial003.py
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial004.py
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial005.py
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial006.py
tests/test_tutorial/test_query_params/test_tutorial001.py
tests/test_tutorial/test_query_params/test_tutorial002.py
tests/test_tutorial/test_query_params/test_tutorial003.py
tests/test_tutorial/test_query_params/test_tutorial004.py
tests/test_tutorial/test_query_params/test_tutorial005.py
tests/test_tutorial/test_query_params/test_tutorial006.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial001.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial002.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial003.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial004.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial005.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial006.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial006c.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial007.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial008.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial009.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial010.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial011.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial012.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial013.py
tests/test_tutorial/test_query_params_str_validations/test_tutorial014.py
tests/test_tutorial/test_request_files/test_tutorial001.py
tests/test_tutorial/test_request_files/test_tutorial001_03.py
tests/test_tutorial/test_request_files/test_tutorial002.py
tests/test_tutorial/test_request_files/test_tutorial003.py
tests/test_tutorial/test_request_form_models/test_tutorial001.py
tests/test_tutorial/test_request_form_models/test_tutorial002.py
tests/test_tutorial/test_request_forms/test_tutorial001.py
tests/test_tutorial/test_request_forms_and_files/test_tutorial001.py
tests/test_tutorial/test_response_directly/test_tutorial001.py
tests/test_tutorial/test_response_directly/test_tutorial002.py
tests/test_tutorial/test_response_model/test_tutorial001_tutorial001_01.py
tests/test_tutorial/test_response_model/test_tutorial002.py
tests/test_tutorial/test_response_model/test_tutorial003_02.py
tests/test_tutorial/test_response_model/test_tutorial003_03.py
tests/test_tutorial/test_response_model/test_tutorial003_05.py
tests/test_tutorial/test_response_status_code/test_tutorial001_tutorial002.py
tests/test_tutorial/test_schema_extra_example/test_tutorial001.py
tests/test_tutorial/test_schema_extra_example/test_tutorial002.py
tests/test_tutorial/test_schema_extra_example/test_tutorial003.py
tests/test_tutorial/test_schema_extra_example/test_tutorial004.py
tests/test_tutorial/test_schema_extra_example/test_tutorial005.py
tests/test_tutorial/test_security/test_tutorial001.py
tests/test_tutorial/test_security/test_tutorial002.py
tests/test_tutorial/test_security/test_tutorial003.py
tests/test_tutorial/test_security/test_tutorial004.py
tests/test_tutorial/test_security/test_tutorial006.py
tests/test_tutorial/test_security/test_tutorial007.py
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001.py
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py
tests/test_tutorial/test_settings/test_app01.py
tests/test_tutorial/test_static_files/test_tutorial001.py
tests/test_tutorial/test_sub_applications/test_tutorial001.py
tests/test_tutorial/test_testing/test_main_a.py
tests/test_tutorial/test_testing/test_tutorial001.py
tests/test_tutorial/test_using_request_directly/test_tutorial001.py
tests/test_union_body.py
tests/test_union_forms.py
tests/test_union_inherited_body.py
tests/test_webhooks_security.py

index 935acca42eb6dab89c4517d9725c3dbe4268843a..130a6662a181dceb987797071ded8cc2d25014a4 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -26,84 +27,88 @@ def test_additional_properties_post():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/foo": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/foo": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Foo",
+                        "operationId": "foo_foo_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Items"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Foo",
-                    "operationId": "foo_foo_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Items"}
+                    }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Items": {
+                        "title": "Items",
+                        "required": ["items"],
+                        "type": "object",
+                        "properties": {
+                            "items": {
+                                "title": "Items",
+                                "type": "object",
+                                "additionalProperties": {"type": "integer"},
                             }
                         },
-                        "required": True,
                     },
-                }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Items": {
-                    "title": "Items",
-                    "required": ["items"],
-                    "type": "object",
-                    "properties": {
-                        "items": {
-                            "title": "Items",
-                            "type": "object",
-                            "additionalProperties": {"type": "integer"},
-                        }
-                    },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 3b323ad46353df1112d63e275f042ac8d91b79f5..c02841cde19bcb3ee1e094cf9d7f0599214618ff 100644 (file)
@@ -2,6 +2,7 @@ from typing import Union
 
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, ConfigDict
 
 
@@ -40,83 +41,87 @@ def test_call_valid():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post",
-                    "operationId": "post__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "anyOf": [
-                                        {"$ref": "#/components/schemas/Foo"},
-                                        {"type": "null"},
-                                    ],
-                                    "title": "Foo",
-                                }
-                            }
-                        }
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post",
+                        "operationId": "post__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "anyOf": [
+                                            {"$ref": "#/components/schemas/Foo"},
+                                            {"type": "null"},
+                                        ],
+                                        "title": "Foo",
                                     }
                                 }
+                            }
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Foo": {
-                    "properties": {},
-                    "additionalProperties": False,
-                    "type": "object",
-                    "title": "Foo",
-                },
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "Foo": {
+                        "properties": {},
+                        "additionalProperties": False,
+                        "type": "object",
+                        "title": "Foo",
+                    },
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 55be19bad25a85d57f7ded06b6c04c30ac9cd2c0..70a9a7331228d1020201d5df9063869f90390efb 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import APIRouter, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 router = APIRouter()
 
@@ -29,21 +30,23 @@ def test_path_operation():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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 Item",
-                    "operationId": "read_item_items__get",
+    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 Item",
+                        "operationId": "read_item_items__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 8724e5ecb849d892f9484c255c9863136a1744a8..9b468c6217f077b45798b003fcb6e68d5b1da2ec 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI
 from fastapi.responses import JSONResponse
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -34,64 +35,66 @@ client = TestClient(app)
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a/{id}": {
-                "get": {
-                    "responses": {
-                        "422": {
-                            "description": "Error",
-                            "content": {
-                                "application/vnd.api+json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/JsonApiError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a/{id}": {
+                    "get": {
+                        "responses": {
+                            "422": {
+                                "description": "Error",
+                                "content": {
+                                    "application/vnd.api+json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/JsonApiError"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/vnd.api+json": {"schema": {}}},
                             },
                         },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/vnd.api+json": {"schema": {}}},
-                        },
-                    },
-                    "summary": "A",
-                    "operationId": "a_a__id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Id"},
-                            "name": "id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "A",
+                        "operationId": "a_a__id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Id"},
+                                "name": "id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Error": {
-                    "title": "Error",
-                    "required": ["status", "title"],
-                    "type": "object",
-                    "properties": {
-                        "status": {"title": "Status", "type": "string"},
-                        "title": {"title": "Title", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Error": {
+                        "title": "Error",
+                        "required": ["status", "title"],
+                        "type": "object",
+                        "properties": {
+                            "status": {"title": "Status", "type": "string"},
+                            "title": {"title": "Title", "type": "string"},
+                        },
                     },
-                },
-                "JsonApiError": {
-                    "title": "JsonApiError",
-                    "required": ["errors"],
-                    "type": "object",
-                    "properties": {
-                        "errors": {
-                            "title": "Errors",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Error"},
-                        }
+                    "JsonApiError": {
+                        "title": "JsonApiError",
+                        "required": ["errors"],
+                        "type": "object",
+                        "properties": {
+                            "errors": {
+                                "title": "Errors",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Error"},
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index acc081fb16e434598e3400e0b5af93c07168de16..09e03959e55a0725e79f1b401d6872671bce40ac 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -15,72 +16,76 @@ client = TestClient(app)
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a/{id}": {
-                "get": {
-                    "responses": {
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a/{id}": {
+                    "get": {
+                        "responses": {
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
                         },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                    },
-                    "summary": "A",
-                    "operationId": "a_a__id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Id"},
-                            "name": "id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "A",
+                        "operationId": "a_a__id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Id"},
+                                "name": "id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fecc3ee16b9dfb009c195f1d65ad20a2ea36844f..3faab27978ee06092ffb37407cafbc23bb74ba88 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI
 from fastapi.responses import JSONResponse
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -39,76 +40,78 @@ client = TestClient(app)
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a": {
-                "get": {
-                    "responses": {
-                        "500": {
-                            "description": "Error",
-                            "content": {
-                                "application/vnd.api+json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/JsonApiError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a": {
+                    "get": {
+                        "responses": {
+                            "500": {
+                                "description": "Error",
+                                "content": {
+                                    "application/vnd.api+json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/JsonApiError"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/vnd.api+json": {"schema": {}}},
                             },
                         },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/vnd.api+json": {"schema": {}}},
+                        "summary": "A",
+                        "operationId": "a_a_get",
+                    }
+                },
+                "/b": {
+                    "get": {
+                        "responses": {
+                            "500": {
+                                "description": "Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Error"}
+                                    }
+                                },
+                            },
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
                         },
-                    },
-                    "summary": "A",
-                    "operationId": "a_a_get",
-                }
+                        "summary": "B",
+                        "operationId": "b_b_get",
+                    }
+                },
             },
-            "/b": {
-                "get": {
-                    "responses": {
-                        "500": {
-                            "description": "Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Error"}
-                                }
-                            },
+            "components": {
+                "schemas": {
+                    "Error": {
+                        "title": "Error",
+                        "required": ["status", "title"],
+                        "type": "object",
+                        "properties": {
+                            "status": {"title": "Status", "type": "string"},
+                            "title": {"title": "Title", "type": "string"},
                         },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    },
+                    "JsonApiError": {
+                        "title": "JsonApiError",
+                        "required": ["errors"],
+                        "type": "object",
+                        "properties": {
+                            "errors": {
+                                "title": "Errors",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Error"},
+                            }
                         },
                     },
-                    "summary": "B",
-                    "operationId": "b_b_get",
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "Error": {
-                    "title": "Error",
-                    "required": ["status", "title"],
-                    "type": "object",
-                    "properties": {
-                        "status": {"title": "Status", "type": "string"},
-                        "title": {"title": "Title", "type": "string"},
-                    },
-                },
-                "JsonApiError": {
-                    "title": "JsonApiError",
-                    "required": ["errors"],
-                    "type": "object",
-                    "properties": {
-                        "errors": {
-                            "title": "Errors",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Error"},
-                        }
-                    },
-                },
-            }
-        },
-    }
+        }
+    )
index 71cabc7c3d1142d15bf3524669cddf48e530504e..b6c359ba8b55e1d145f8470a725f39d48ad9863b 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import APIRouter, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 
@@ -84,94 +85,98 @@ def test_d():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a": {
-                "get": {
-                    "responses": {
-                        "501": {"description": "Error 1"},
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a": {
+                    "get": {
+                        "responses": {
+                            "501": {"description": "Error 1"},
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
                         },
-                    },
-                    "summary": "A",
-                    "operationId": "a_a_get",
-                }
-            },
-            "/b": {
-                "get": {
-                    "responses": {
-                        "502": {"description": "Error 2"},
-                        "4XX": {"description": "Error with range, upper"},
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "summary": "A",
+                        "operationId": "a_a_get",
+                    }
+                },
+                "/b": {
+                    "get": {
+                        "responses": {
+                            "502": {"description": "Error 2"},
+                            "4XX": {"description": "Error with range, upper"},
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
                         },
-                    },
-                    "summary": "B",
-                    "operationId": "b_b_get",
-                }
-            },
-            "/c": {
-                "get": {
-                    "responses": {
-                        "400": {"description": "Error with str"},
-                        "5XX": {"description": "Error with range, lower"},
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "summary": "B",
+                        "operationId": "b_b_get",
+                    }
+                },
+                "/c": {
+                    "get": {
+                        "responses": {
+                            "400": {"description": "Error with str"},
+                            "5XX": {"description": "Error with range, lower"},
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "default": {"description": "A default response"},
                         },
-                        "default": {"description": "A default response"},
-                    },
-                    "summary": "C",
-                    "operationId": "c_c_get",
-                }
-            },
-            "/d": {
-                "get": {
-                    "responses": {
-                        "400": {"description": "Error with str"},
-                        "5XX": {
-                            "description": "Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseModel"
+                        "summary": "C",
+                        "operationId": "c_c_get",
+                    }
+                },
+                "/d": {
+                    "get": {
+                        "responses": {
+                            "400": {"description": "Error with str"},
+                            "5XX": {
+                                "description": "Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseModel"
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "default": {
-                            "description": "Default Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseModel"
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "default": {
+                                "description": "Default Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseModel"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "D",
-                    "operationId": "d_d_get",
-                }
+                        "summary": "D",
+                        "operationId": "d_d_get",
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "ResponseModel": {
-                    "title": "ResponseModel",
-                    "required": ["message"],
-                    "type": "object",
-                    "properties": {"message": {"title": "Message", "type": "string"}},
+            "components": {
+                "schemas": {
+                    "ResponseModel": {
+                        "title": "ResponseModel",
+                        "required": ["message"],
+                        "type": "object",
+                        "properties": {
+                            "message": {"title": "Message", "type": "string"}
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index f5d987ca31a0dcaed4464ca1c10a198a5b1a9649..5d833fce4a4cf838b0491162d1235a357dcf15e5 100644 (file)
@@ -8,6 +8,7 @@ from typing import Union
 
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 
@@ -45,79 +46,81 @@ client = TestClient(app)
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/route1": {
-                "get": {
-                    "summary": "Route1",
-                    "operationId": "route1_route1_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "500": {
-                            "description": "Internal Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "anyOf": [
-                                            {"$ref": "#/components/schemas/ModelA"},
-                                            {"$ref": "#/components/schemas/ModelB"},
-                                        ],
-                                        "title": "Response 500 Route1 Route1 Get",
-                                    },
-                                    "examples": {"Case A": {"value": "a"}},
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/route1": {
+                    "get": {
+                        "summary": "Route1",
+                        "operationId": "route1_route1_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "500": {
+                                "description": "Internal Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "anyOf": [
+                                                {"$ref": "#/components/schemas/ModelA"},
+                                                {"$ref": "#/components/schemas/ModelB"},
+                                            ],
+                                            "title": "Response 500 Route1 Route1 Get",
+                                        },
+                                        "examples": {"Case A": {"value": "a"}},
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/route2": {
-                "get": {
-                    "summary": "Route2",
-                    "operationId": "route2_route2_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "500": {
-                            "description": "Internal Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "anyOf": [
-                                            {"$ref": "#/components/schemas/ModelA"},
-                                            {"$ref": "#/components/schemas/ModelB"},
-                                        ],
-                                        "title": "Response 500 Route2 Route2 Get",
-                                    },
-                                    "examples": {"Case A": {"value": "a"}},
-                                }
+                    }
+                },
+                "/route2": {
+                    "get": {
+                        "summary": "Route2",
+                        "operationId": "route2_route2_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "500": {
+                                "description": "Internal Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "anyOf": [
+                                                {"$ref": "#/components/schemas/ModelA"},
+                                                {"$ref": "#/components/schemas/ModelB"},
+                                            ],
+                                            "title": "Response 500 Route2 Route2 Get",
+                                        },
+                                        "examples": {"Case A": {"value": "a"}},
+                                    }
+                                },
                             },
                         },
+                    }
+                },
+            },
+            "components": {
+                "schemas": {
+                    "ModelA": {
+                        "properties": {"a": {"type": "string", "title": "A"}},
+                        "type": "object",
+                        "required": ["a"],
+                        "title": "ModelA",
+                    },
+                    "ModelB": {
+                        "properties": {"b": {"type": "string", "title": "B"}},
+                        "type": "object",
+                        "required": ["b"],
+                        "title": "ModelB",
                     },
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "ModelA": {
-                    "properties": {"a": {"type": "string", "title": "A"}},
-                    "type": "object",
-                    "required": ["a"],
-                    "title": "ModelA",
-                },
-                "ModelB": {
-                    "properties": {"b": {"type": "string", "title": "B"}},
-                    "type": "object",
-                    "required": ["b"],
-                    "title": "ModelB",
-                },
-            }
-        },
-    }
+        }
+    )
index 99bd03ae6ffad56436ba05f7eadbdf800b27e060..68e2ea884c280721d93cf7d2399aed713ad1c5d3 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated
 import pytest
 from fastapi import APIRouter, FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -120,174 +121,178 @@ def test_nested_router():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/default": {
-                "get": {
-                    "summary": "Default",
-                    "operationId": "default_default_get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Foo",
-                                "type": "string",
-                                "default": "foo",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/default": {
+                    "get": {
+                        "summary": "Default",
+                        "operationId": "default_default_get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Foo",
+                                    "type": "string",
+                                    "default": "foo",
+                                },
+                                "name": "foo",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                            "name": "foo",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/required": {
-                "get": {
-                    "summary": "Required",
-                    "operationId": "required_required_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Foo",
-                                "minLength": 1,
-                                "type": "string",
+                    }
+                },
+                "/required": {
+                    "get": {
+                        "summary": "Required",
+                        "operationId": "required_required_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Foo",
+                                    "minLength": 1,
+                                    "type": "string",
+                                },
+                                "name": "foo",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                            "name": "foo",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/multiple": {
-                "get": {
-                    "summary": "Multiple",
-                    "operationId": "multiple_multiple_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Foo",
-                                "minLength": 1,
-                                "type": "string",
+                    }
+                },
+                "/multiple": {
+                    "get": {
+                        "summary": "Multiple",
+                        "operationId": "multiple_multiple_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Foo",
+                                    "minLength": 1,
+                                    "type": "string",
+                                },
+                                "name": "foo",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                            "name": "foo",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/unrelated": {
-                "get": {
-                    "summary": "Unrelated",
-                    "operationId": "unrelated_unrelated_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Foo", "type": "string"},
-                            "name": "foo",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/unrelated": {
+                    "get": {
+                        "summary": "Unrelated",
+                        "operationId": "unrelated_unrelated_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Foo", "type": "string"},
+                                "name": "foo",
+                                "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"},
-                        }
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fe97e674c0606653174821913a59a6f8a5ac9220..6758662980e04256687f9b7f25ba41eb26343dc1 100644 (file)
@@ -1,5 +1,6 @@
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from .main import app
 
@@ -54,1227 +55,1231 @@ def test_enum_status_code_response():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "externalDocs": {
-            "description": "External API documentation.",
-            "url": "https://docs.example.com/api-general",
-        },
-        "paths": {
-            "/api_route": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Non Operation",
-                    "operationId": "non_operation_api_route_get",
-                }
-            },
-            "/non_decorated_route": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Non Decorated Route",
-                    "operationId": "non_decorated_route_non_decorated_route_get",
-                }
-            },
-            "/text": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Get Text",
-                    "operationId": "get_text_text_get",
-                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "externalDocs": {
+                "description": "External API documentation.",
+                "url": "https://docs.example.com/api-general",
             },
-            "/path/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+            "paths": {
+                "/api_route": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Non Operation",
+                        "operationId": "non_operation_api_route_get",
+                    }
+                },
+                "/non_decorated_route": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Non Decorated Route",
+                        "operationId": "non_decorated_route_non_decorated_route_get",
+                    }
+                },
+                "/text": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Get Text",
+                        "operationId": "get_text_text_get",
+                    }
+                },
+                "/path/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Id",
-                    "operationId": "get_id_path__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/str/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Id",
+                        "operationId": "get_id_path__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/str/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Str Id",
-                    "operationId": "get_str_id_path_str__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Str Id",
+                        "operationId": "get_str_id_path_str__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Int Id",
-                    "operationId": "get_int_id_path_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/float/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Int Id",
+                        "operationId": "get_int_id_path_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/float/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Float Id",
-                    "operationId": "get_float_id_path_float__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "number"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/bool/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Float Id",
+                        "operationId": "get_float_id_path_float__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "number"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/bool/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Bool Id",
-                    "operationId": "get_bool_id_path_bool__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "boolean"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Bool Id",
+                        "operationId": "get_bool_id_path_bool__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "boolean"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Id",
-                    "operationId": "get_path_param_id_path_param__item_id__get",
-                    "parameters": [
-                        {
-                            "name": "item_id",
-                            "in": "path",
-                            "required": True,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Item Id",
-                            },
-                        }
-                    ],
-                }
-            },
-            "/path/param-minlength/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Id",
+                        "operationId": "get_path_param_id_path_param__item_id__get",
+                        "parameters": [
+                            {
+                                "name": "item_id",
+                                "in": "path",
+                                "required": True,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Item Id",
+                                },
+                            }
+                        ],
+                    }
+                },
+                "/path/param-minlength/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Min Length",
-                    "operationId": "get_path_param_min_length_path_param_minlength__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "minLength": 3,
-                                "type": "string",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-maxlength/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Min Length",
+                        "operationId": "get_path_param_min_length_path_param_minlength__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "minLength": 3,
+                                    "type": "string",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-maxlength/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Max Length",
-                    "operationId": "get_path_param_max_length_path_param_maxlength__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "maxLength": 3,
-                                "type": "string",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-min_maxlength/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Max Length",
+                        "operationId": "get_path_param_max_length_path_param_maxlength__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "maxLength": 3,
+                                    "type": "string",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-min_maxlength/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Min Max Length",
-                    "operationId": "get_path_param_min_max_length_path_param_min_maxlength__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "maxLength": 3,
-                                "minLength": 2,
-                                "type": "string",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-gt/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Min Max Length",
+                        "operationId": "get_path_param_min_max_length_path_param_min_maxlength__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "maxLength": 3,
+                                    "minLength": 2,
+                                    "type": "string",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-gt/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Gt",
-                    "operationId": "get_path_param_gt_path_param_gt__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMinimum": 3.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-gt0/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Gt",
+                        "operationId": "get_path_param_gt_path_param_gt__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMinimum": 3.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-gt0/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Gt0",
-                    "operationId": "get_path_param_gt0_path_param_gt0__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMinimum": 0.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-ge/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Gt0",
+                        "operationId": "get_path_param_gt0_path_param_gt0__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMinimum": 0.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-ge/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Ge",
-                    "operationId": "get_path_param_ge_path_param_ge__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "minimum": 3.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-lt/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Ge",
+                        "operationId": "get_path_param_ge_path_param_ge__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "minimum": 3.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-lt/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Lt",
-                    "operationId": "get_path_param_lt_path_param_lt__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMaximum": 3.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-lt0/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Lt",
+                        "operationId": "get_path_param_lt_path_param_lt__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMaximum": 3.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-lt0/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Lt0",
-                    "operationId": "get_path_param_lt0_path_param_lt0__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMaximum": 0.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-le/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Lt0",
+                        "operationId": "get_path_param_lt0_path_param_lt0__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMaximum": 0.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-le/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Le",
-                    "operationId": "get_path_param_le_path_param_le__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "maximum": 3.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-lt-gt/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Le",
+                        "operationId": "get_path_param_le_path_param_le__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "maximum": 3.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-lt-gt/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Lt Gt",
-                    "operationId": "get_path_param_lt_gt_path_param_lt_gt__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMaximum": 3.0,
-                                "exclusiveMinimum": 1.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-le-ge/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Lt Gt",
+                        "operationId": "get_path_param_lt_gt_path_param_lt_gt__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMaximum": 3.0,
+                                    "exclusiveMinimum": 1.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-le-ge/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Le Ge",
-                    "operationId": "get_path_param_le_ge_path_param_le_ge__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "maximum": 3.0,
-                                "minimum": 1.0,
-                                "type": "number",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-lt-int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Le Ge",
+                        "operationId": "get_path_param_le_ge_path_param_le_ge__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "maximum": 3.0,
+                                    "minimum": 1.0,
+                                    "type": "number",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-lt-int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Lt Int",
-                    "operationId": "get_path_param_lt_int_path_param_lt_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMaximum": 3.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-gt-int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Lt Int",
+                        "operationId": "get_path_param_lt_int_path_param_lt_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMaximum": 3.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-gt-int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Gt Int",
-                    "operationId": "get_path_param_gt_int_path_param_gt_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMinimum": 3.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-le-int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Gt Int",
+                        "operationId": "get_path_param_gt_int_path_param_gt_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMinimum": 3.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-le-int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Le Int",
-                    "operationId": "get_path_param_le_int_path_param_le_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "maximum": 3.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-ge-int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Le Int",
+                        "operationId": "get_path_param_le_int_path_param_le_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "maximum": 3.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-ge-int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Ge Int",
-                    "operationId": "get_path_param_ge_int_path_param_ge_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "minimum": 3.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-lt-gt-int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Ge Int",
+                        "operationId": "get_path_param_ge_int_path_param_ge_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "minimum": 3.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-lt-gt-int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Lt Gt Int",
-                    "operationId": "get_path_param_lt_gt_int_path_param_lt_gt_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "exclusiveMaximum": 3.0,
-                                "exclusiveMinimum": 1.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/path/param-le-ge-int/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Lt Gt Int",
+                        "operationId": "get_path_param_lt_gt_int_path_param_lt_gt_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "exclusiveMaximum": 3.0,
+                                    "exclusiveMinimum": 1.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/path/param-le-ge-int/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Path Param Le Ge Int",
-                    "operationId": "get_path_param_le_ge_int_path_param_le_ge_int__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "maximum": 3.0,
-                                "minimum": 1.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/query": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Path Param Le Ge Int",
+                        "operationId": "get_path_param_le_ge_int_path_param_le_ge_int__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "maximum": 3.0,
+                                    "minimum": 1.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/query": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query",
-                    "operationId": "get_query_query_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Query"},
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/query/optional": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query",
+                        "operationId": "get_query_query_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Query"},
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/query/optional": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Optional",
-                    "operationId": "get_query_optional_query_optional_get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {"title": "Query"},
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/query/int": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query Optional",
+                        "operationId": "get_query_optional_query_optional_get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {"title": "Query"},
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/query/int": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Type",
-                    "operationId": "get_query_type_query_int_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Query", "type": "integer"},
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/query/int/optional": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query Type",
+                        "operationId": "get_query_type_query_int_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Query", "type": "integer"},
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/query/int/optional": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Type Optional",
-                    "operationId": "get_query_type_optional_query_int_optional_get",
-                    "parameters": [
-                        {
-                            "name": "query",
-                            "in": "query",
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "integer"}, {"type": "null"}],
-                                "title": "Query",
-                            },
-                        }
-                    ],
-                }
-            },
-            "/query/int/default": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query Type Optional",
+                        "operationId": "get_query_type_optional_query_int_optional_get",
+                        "parameters": [
+                            {
+                                "name": "query",
+                                "in": "query",
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "integer"}, {"type": "null"}],
+                                    "title": "Query",
+                                },
+                            }
+                        ],
+                    }
+                },
+                "/query/int/default": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Type Int Default",
-                    "operationId": "get_query_type_int_default_query_int_default_get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Query",
-                                "type": "integer",
-                                "default": 10,
-                            },
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/query/param": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query Type Int Default",
+                        "operationId": "get_query_type_int_default_query_int_default_get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Query",
+                                    "type": "integer",
+                                    "default": 10,
+                                },
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/query/param": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Param",
-                    "operationId": "get_query_param_query_param_get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {"title": "Query"},
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/query/param-required": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query Param",
+                        "operationId": "get_query_param_query_param_get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {"title": "Query"},
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/query/param-required": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Param Required",
-                    "operationId": "get_query_param_required_query_param_required_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Query"},
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/query/param-required/int": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Query Param Required",
+                        "operationId": "get_query_param_required_query_param_required_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Query"},
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/query/param-required/int": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Query Param Required Type",
-                    "operationId": "get_query_param_required_type_query_param_required_int_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Query", "type": "integer"},
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                }
-            },
-            "/enum-status-code": {
-                "get": {
-                    "responses": {
-                        "201": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                    },
-                    "summary": "Get Enum Status Code",
-                    "operationId": "get_enum_status_code_enum_status_code_get",
-                }
-            },
-            "/query/frozenset": {
-                "get": {
-                    "summary": "Get Query Type Frozenset",
-                    "operationId": "get_query_type_frozenset_query_frozenset_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Query",
-                                "uniqueItems": True,
-                                "type": "array",
-                                "items": {"type": "integer"},
-                            },
-                            "name": "query",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "summary": "Get Query Param Required Type",
+                        "operationId": "get_query_param_required_type_query_param_required_int_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Query", "type": "integer"},
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                    }
+                },
+                "/enum-status-code": {
+                    "get": {
+                        "responses": {
+                            "201": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Get Enum Status Code",
+                        "operationId": "get_enum_status_code_enum_status_code_get",
+                    }
+                },
+                "/query/frozenset": {
+                    "get": {
+                        "summary": "Get Query Type Frozenset",
+                        "operationId": "get_query_type_frozenset_query_frozenset_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Query",
+                                    "uniqueItems": True,
+                                    "type": "array",
+                                    "items": {"type": "integer"},
+                                },
+                                "name": "query",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/query/list": {
-                "get": {
-                    "summary": "Get Query List",
-                    "operationId": "get_query_list_query_list_get",
-                    "parameters": [
-                        {
-                            "name": "device_ids",
-                            "in": "query",
-                            "required": True,
-                            "schema": {
-                                "type": "array",
-                                "items": {"type": "integer"},
-                                "title": "Device Ids",
-                            },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "type": "array",
-                                        "items": {"type": "integer"},
-                                        "title": "Response Get Query List Query List Get",
+                    }
+                },
+                "/query/list": {
+                    "get": {
+                        "summary": "Get Query List",
+                        "operationId": "get_query_list_query_list_get",
+                        "parameters": [
+                            {
+                                "name": "device_ids",
+                                "in": "query",
+                                "required": True,
+                                "schema": {
+                                    "type": "array",
+                                    "items": {"type": "integer"},
+                                    "title": "Device Ids",
+                                },
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "type": "array",
+                                            "items": {"type": "integer"},
+                                            "title": "Response Get Query List Query List Get",
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/query/list-default": {
-                "get": {
-                    "summary": "Get Query List Default",
-                    "operationId": "get_query_list_default_query_list_default_get",
-                    "parameters": [
-                        {
-                            "name": "device_ids",
-                            "in": "query",
-                            "required": False,
-                            "schema": {
-                                "type": "array",
-                                "items": {"type": "integer"},
-                                "default": [],
-                                "title": "Device Ids",
-                            },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "type": "array",
-                                        "items": {"type": "integer"},
-                                        "title": "Response Get Query List Default Query List Default Get",
+                    }
+                },
+                "/query/list-default": {
+                    "get": {
+                        "summary": "Get Query List Default",
+                        "operationId": "get_query_list_default_query_list_default_get",
+                        "parameters": [
+                            {
+                                "name": "device_ids",
+                                "in": "query",
+                                "required": False,
+                                "schema": {
+                                    "type": "array",
+                                    "items": {"type": "integer"},
+                                    "default": [],
+                                    "title": "Device Ids",
+                                },
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "type": "array",
+                                            "items": {"type": "integer"},
+                                            "title": "Response Get Query List Default Query List Default Get",
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index e7f969f7cf4f9d590e32707702fc3eb3437d1244..af6654a6396f202d335dbc389743b4f6930f376d 100644 (file)
@@ -1,6 +1,7 @@
 import pytest
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(name="client")
@@ -43,55 +44,65 @@ def test_get(client: TestClient, path: str):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "summary": "Read Root",
-                    "operationId": "read_root__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Rectangle"}
-                                }
-                            },
-                        }
-                    },
-                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "summary": "Read Root",
+                        "operationId": "read_root__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/Rectangle"
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/responses": {
+                    "get": {
+                        "summary": "Read Responses",
+                        "operationId": "read_responses_responses_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/Rectangle"
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
             },
-            "/responses": {
-                "get": {
-                    "summary": "Read Responses",
-                    "operationId": "read_responses_responses_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Rectangle"}
-                                }
+            "components": {
+                "schemas": {
+                    "Rectangle": {
+                        "properties": {
+                            "width": {"type": "integer", "title": "Width"},
+                            "length": {"type": "integer", "title": "Length"},
+                            "area": {
+                                "type": "integer",
+                                "title": "Area",
+                                "readOnly": True,
                             },
-                        }
-                    },
+                        },
+                        "type": "object",
+                        "required": ["width", "length", "area"],
+                        "title": "Rectangle",
+                    }
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "Rectangle": {
-                    "properties": {
-                        "width": {"type": "integer", "title": "Width"},
-                        "length": {"type": "integer", "title": "Length"},
-                        "area": {"type": "integer", "title": "Area", "readOnly": True},
-                    },
-                    "type": "object",
-                    "required": ["width", "length", "area"],
-                    "title": "Rectangle",
-                }
-            }
-        },
-    }
+        }
+    )
index 55374584b095a23cc1beb90f7193c44834c6ccdf..786c1efc318c61875987782ebb48cd5bde768ba7 100644 (file)
@@ -2,6 +2,7 @@ import pytest
 from fastapi import APIRouter, FastAPI
 from fastapi.routing import APIRoute
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from starlette.routing import Route
 
 app = FastAPI()
@@ -74,45 +75,47 @@ def test_route_classes():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Get A",
-                    "operationId": "get_a_a__get",
-                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Get A",
+                        "operationId": "get_a_a__get",
+                    }
+                },
+                "/a/b/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Get B",
+                        "operationId": "get_b_a_b__get",
+                    }
+                },
+                "/a/b/c/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Get C",
+                        "operationId": "get_c_a_b_c__get",
+                    }
+                },
             },
-            "/a/b/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Get B",
-                    "operationId": "get_b_a_b__get",
-                }
-            },
-            "/a/b/c/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Get C",
-                    "operationId": "get_c_a_b_c__get",
-                }
-            },
-        },
-    }
+        }
+    )
index 3ca6a3e891606bdbca08108728c7750eb4e581af..81490e68b66443c3454170dda01e1e8572541232 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import Depends, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -84,149 +85,153 @@ def test_sub_duplicates():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/with-duplicates": {
-                "post": {
-                    "summary": "With Duplicates",
-                    "operationId": "with_duplicates_with_duplicates_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/with-duplicates": {
+                    "post": {
+                        "summary": "With Duplicates",
+                        "operationId": "with_duplicates_with_duplicates_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/no-duplicates": {
-                "post": {
-                    "summary": "No Duplicates",
-                    "operationId": "no_duplicates_no_duplicates_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_no_duplicates_no_duplicates_post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/no-duplicates": {
+                    "post": {
+                        "summary": "No Duplicates",
+                        "operationId": "no_duplicates_no_duplicates_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_no_duplicates_no_duplicates_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/with-duplicates-sub": {
-                "post": {
-                    "summary": "No Duplicates Sub",
-                    "operationId": "no_duplicates_sub_with_duplicates_sub_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/with-duplicates-sub": {
+                    "post": {
+                        "summary": "No Duplicates Sub",
+                        "operationId": "no_duplicates_sub_with_duplicates_sub_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "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_no_duplicates_no_duplicates_post": {
-                    "title": "Body_no_duplicates_no_duplicates_post",
-                    "required": ["item", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
+            "components": {
+                "schemas": {
+                    "Body_no_duplicates_no_duplicates_post": {
+                        "title": "Body_no_duplicates_no_duplicates_post",
+                        "required": ["item", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["data"],
-                    "type": "object",
-                    "properties": {"data": {"title": "Data", "type": "string"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "Item": {
+                        "title": "Item",
+                        "required": ["data"],
+                        "type": "object",
+                        "properties": {"data": {"title": "Data", "type": "string"}},
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index ec7366d2af7025bc89c028b3728333b39e503482..24198af3465eda51d543007c823f0ce100366421 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI, Request
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI(openapi_prefix="/api/v1")
 
@@ -21,22 +22,24 @@ def test_main():
 def test_openapi():
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/app": {
-                "get": {
-                    "summary": "Read Main",
-                    "operationId": "read_main_app_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/app": {
+                    "get": {
+                        "summary": "Read Main",
+                        "operationId": "read_main_app_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-        "servers": [{"url": "/api/v1"}],
-    }
+            },
+            "servers": [{"url": "/api/v1"}],
+        }
+    )
index 83e86d231a6f9b9448df70c7d7b095974f7cbae5..d5a6d1fec5ce1ec569804014124928e7332ce81d 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -35,45 +36,49 @@ def test_get_api_route():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "summary": "F",
-                    "operationId": "f__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Model3"}
-                                }
-                            },
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "summary": "F",
+                        "operationId": "f__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/Model3"
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Model": {"title": "Model", "type": "object", "properties": {}},
-                "Model2": {
-                    "title": "Model2",
-                    "required": ["a"],
-                    "type": "object",
-                    "properties": {"a": {"$ref": "#/components/schemas/Model"}},
-                },
-                "Model3": {
-                    "title": "Model3",
-                    "required": ["c", "d"],
-                    "type": "object",
-                    "properties": {
-                        "c": {"$ref": "#/components/schemas/Model"},
-                        "d": {"$ref": "#/components/schemas/Model2"},
+            },
+            "components": {
+                "schemas": {
+                    "Model": {"title": "Model", "type": "object", "properties": {}},
+                    "Model2": {
+                        "title": "Model2",
+                        "required": ["a"],
+                        "type": "object",
+                        "properties": {"a": {"$ref": "#/components/schemas/Model"}},
+                    },
+                    "Model3": {
+                        "title": "Model3",
+                        "required": ["c", "d"],
+                        "type": "object",
+                        "properties": {
+                            "c": {"$ref": "#/components/schemas/Model"},
+                            "d": {"$ref": "#/components/schemas/Model2"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c46a543576b284004ab27f8b6924e61215485c1e..0dee15c25d74dda79376af33b79456c0e409cdf1 100644 (file)
@@ -1,7 +1,8 @@
 from typing import Optional
 
-from fastapi import Depends, FastAPI, Query, status
+from fastapi import Depends, FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -26,81 +27,6 @@ def foo_handler(
 
 client = TestClient(app)
 
-expected_schema = {
-    "components": {
-        "schemas": {
-            "HTTPValidationError": {
-                "properties": {
-                    "detail": {
-                        "items": {"$ref": "#/components/schemas/ValidationError"},
-                        "title": "Detail",
-                        "type": "array",
-                    }
-                },
-                "title": "HTTPValidationError",
-                "type": "object",
-            },
-            "ValidationError": {
-                "properties": {
-                    "ctx": {"title": "Context", "type": "object"},
-                    "input": {"title": "Input"},
-                    "loc": {
-                        "items": {"anyOf": [{"type": "string"}, {"type": "integer"}]},
-                        "title": "Location",
-                        "type": "array",
-                    },
-                    "msg": {"title": "Message", "type": "string"},
-                    "type": {"title": "Error Type", "type": "string"},
-                },
-                "required": ["loc", "msg", "type"],
-                "title": "ValidationError",
-                "type": "object",
-            },
-        }
-    },
-    "info": {"title": "FastAPI", "version": "0.1.0"},
-    "openapi": "3.1.0",
-    "paths": {
-        "/foo": {
-            "get": {
-                "operationId": "foo_handler_foo_get",
-                "parameters": [
-                    {
-                        "in": "query",
-                        "name": "client_id",
-                        "required": True,
-                        "schema": {"title": "Client Id", "type": "string"},
-                    },
-                ],
-                "responses": {
-                    "200": {
-                        "content": {"application/json": {"schema": {}}},
-                        "description": "Successful Response",
-                    },
-                    "422": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/HTTPValidationError"
-                                }
-                            }
-                        },
-                        "description": "Validation Error",
-                    },
-                },
-                "summary": "Foo Handler",
-            }
-        }
-    },
-}
-
-
-def test_schema():
-    response = client.get("/openapi.json")
-    assert response.status_code == status.HTTP_200_OK
-    actual_schema = response.json()
-    assert actual_schema == expected_schema
-
 
 def test_get_invalid():
     response = client.get("/foo")
@@ -111,3 +37,81 @@ def test_get_valid():
     response = client.get("/foo", params={"client_id": "bar"})
     assert response.status_code == 200
     assert response.json() == {"client_id": "bar_key", "client_tag": "bar_tag"}
+
+
+def test_openapi_schema():
+    response = client.get("/openapi.json")
+    assert response.status_code == 200, response.text
+    assert response.json() == snapshot(
+        {
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "title": "Detail",
+                                "type": "array",
+                            }
+                        },
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
+                        "type": "object",
+                    },
+                }
+            },
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "openapi": "3.1.0",
+            "paths": {
+                "/foo": {
+                    "get": {
+                        "operationId": "foo_handler_foo_get",
+                        "parameters": [
+                            {
+                                "in": "query",
+                                "name": "client_id",
+                                "required": True,
+                                "schema": {"title": "Client Id", "type": "string"},
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                                "description": "Validation Error",
+                            },
+                        },
+                        "summary": "Foo Handler",
+                    }
+                }
+            },
+        }
+    )
index 251af4a59e6630aabd46b676cd398e7316f02a89..96f85b44658a049585f55272c45b2969199a09ba 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI
 from fastapi.responses import JSONResponse
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -98,270 +99,274 @@ def test_trace():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
+                        "summary": "Get Items",
+                        "operationId": "get_items_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
                     },
-                    "summary": "Get Items",
-                    "operationId": "get_items_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                },
-                "delete": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    "delete": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Delete Item",
+                        "operationId": "delete_item_items__item_id__delete",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
-                        },
-                    },
-                    "summary": "Delete Item",
-                    "operationId": "delete_item_items__item_id__delete",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
                         },
-                        "required": True,
                     },
-                },
-                "options": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    "options": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
+                        "summary": "Options Item",
+                        "operationId": "options_item_items__item_id__options",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
                     },
-                    "summary": "Options Item",
-                    "operationId": "options_item_items__item_id__options",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                },
-                "head": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    "head": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
+                        "summary": "Head Item",
+                        "operationId": "head_item_items__item_id__head",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
                     },
-                    "summary": "Head Item",
-                    "operationId": "head_item_items__item_id__head",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                },
-                "patch": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    "patch": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Patch Item",
+                        "operationId": "patch_item_items__item_id__patch",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
-                        },
-                    },
-                    "summary": "Patch Item",
-                    "operationId": "patch_item_items__item_id__patch",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
                         },
-                        "required": True,
                     },
-                },
-                "trace": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    "trace": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
+                        "summary": "Trace Item",
+                        "operationId": "trace_item_items__item_id__trace",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
                     },
-                    "summary": "Trace Item",
-                    "operationId": "trace_item_items__item_id__trace",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
                 },
-            },
-            "/items-not-decorated/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                "/items-not-decorated/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Get Not Decorated",
-                    "operationId": "get_not_decorated_items_not_decorated__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
+                        "summary": "Get Not Decorated",
+                        "operationId": "get_not_decorated_items_not_decorated__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {
-                            "title": "Price",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {
+                                "title": "Price",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fc163cb1efec7d1eb4772d81f193a2c1318194ab..e759b006a654c04e2e29272ae3c67bb68fb3cd74 100644 (file)
@@ -2,6 +2,7 @@ from typing import Annotated
 
 from fastapi import FastAPI, Form
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -23,80 +24,86 @@ def test_single_form_field():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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",
+    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/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$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",
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "Body_post_form_form__post": {
+                        "properties": {
+                            "username": {"type": "string", "title": "Username"}
+                        },
+                        "type": "object",
+                        "required": ["username"],
+                        "title": "Body_post_form_form__post",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "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",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 49510d08a956096f36a076056252008ca02c6d2d..c56e6d5794c39b31712675f74bc647195b86e153 100644 (file)
@@ -3,6 +3,7 @@ import warnings
 from fastapi import APIRouter, FastAPI
 from fastapi.routing import APIRoute
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 
@@ -45,190 +46,197 @@ def test_top_level_generate_unique_id():
     app.include_router(router)
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "foo_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "foo_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Foo Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_foo_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Foo Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/router": {
-                "post": {
-                    "summary": "Post Router",
-                    "operationId": "foo_post_router",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_router"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Foo Post Router",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "404": {
-                            "description": "Not Found",
+                    }
+                },
+                "/router": {
+                    "post": {
+                        "summary": "Post Router",
+                        "operationId": "foo_post_router",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response 404 Foo Post Router",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                                        "$ref": "#/components/schemas/Body_foo_post_router"
                                     }
                                 }
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_foo_post_root": {
-                    "title": "Body_foo_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_foo_post_router": {
-                    "title": "Body_foo_post_router",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
+                    }
                 },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_foo_post_root": {
+                        "title": "Body_foo_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_foo_post_router": {
+                        "title": "Body_foo_post_router",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_router_overrides_generate_unique_id():
@@ -248,190 +256,197 @@ def test_router_overrides_generate_unique_id():
     app.include_router(router)
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "foo_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "foo_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Foo Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_foo_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Foo Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/router": {
-                "post": {
-                    "summary": "Post Router",
-                    "operationId": "bar_post_router",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_bar_post_router"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Bar Post Router",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "404": {
-                            "description": "Not Found",
+                    }
+                },
+                "/router": {
+                    "post": {
+                        "summary": "Post Router",
+                        "operationId": "bar_post_router",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response 404 Bar Post Router",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                                        "$ref": "#/components/schemas/Body_bar_post_router"
                                     }
                                 }
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Bar Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Bar Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_bar_post_router": {
-                    "title": "Body_bar_post_router",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_foo_post_root": {
-                    "title": "Body_foo_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
+                    }
                 },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_bar_post_router": {
+                        "title": "Body_bar_post_router",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_foo_post_root": {
+                        "title": "Body_foo_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_router_include_overrides_generate_unique_id():
@@ -451,190 +466,197 @@ def test_router_include_overrides_generate_unique_id():
     app.include_router(router, generate_unique_id_function=custom_generate_unique_id3)
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "foo_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "foo_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Foo Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_foo_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Foo Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/router": {
-                "post": {
-                    "summary": "Post Router",
-                    "operationId": "bar_post_router",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_bar_post_router"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Bar Post Router",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "404": {
-                            "description": "Not Found",
+                    }
+                },
+                "/router": {
+                    "post": {
+                        "summary": "Post Router",
+                        "operationId": "bar_post_router",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response 404 Bar Post Router",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                                        "$ref": "#/components/schemas/Body_bar_post_router"
                                     }
                                 }
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Bar Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Bar Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_bar_post_router": {
-                    "title": "Body_bar_post_router",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_foo_post_root": {
-                    "title": "Body_foo_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
+                    }
                 },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_bar_post_router": {
+                        "title": "Body_bar_post_router",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_foo_post_root": {
+                        "title": "Body_foo_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_subrouter_top_level_include_overrides_generate_unique_id():
@@ -664,253 +686,262 @@ def test_subrouter_top_level_include_overrides_generate_unique_id():
     app.include_router(router, generate_unique_id_function=custom_generate_unique_id3)
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "foo_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "foo_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Foo Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_foo_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Foo Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/router": {
-                "post": {
-                    "summary": "Post Router",
-                    "operationId": "baz_post_router",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_baz_post_router"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Baz Post Router",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "404": {
-                            "description": "Not Found",
+                    }
+                },
+                "/router": {
+                    "post": {
+                        "summary": "Post Router",
+                        "operationId": "baz_post_router",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response 404 Baz Post Router",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                                        "$ref": "#/components/schemas/Body_baz_post_router"
                                     }
                                 }
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Baz Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/subrouter": {
-                "post": {
-                    "summary": "Post Subrouter",
-                    "operationId": "bar_post_subrouter",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_bar_post_subrouter"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Bar Post Subrouter",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Baz Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Bar Post Subrouter",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/subrouter": {
+                    "post": {
+                        "summary": "Post Subrouter",
+                        "operationId": "bar_post_subrouter",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_bar_post_subrouter"
                                     }
                                 }
                             },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Bar Post Subrouter",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Bar Post Subrouter",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_bar_post_subrouter": {
-                    "title": "Body_bar_post_subrouter",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_baz_post_router": {
-                    "title": "Body_baz_post_router",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_foo_post_root": {
-                    "title": "Body_foo_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
+                    }
                 },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_bar_post_subrouter": {
+                        "title": "Body_bar_post_subrouter",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_baz_post_router": {
+                        "title": "Body_baz_post_router",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_foo_post_root": {
+                        "title": "Body_foo_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_router_path_operation_overrides_generate_unique_id():
@@ -933,190 +964,197 @@ def test_router_path_operation_overrides_generate_unique_id():
     app.include_router(router)
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "foo_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "foo_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Foo Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_foo_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Foo Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/router": {
-                "post": {
-                    "summary": "Post Router",
-                    "operationId": "baz_post_router",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_baz_post_router"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Baz Post Router",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "404": {
-                            "description": "Not Found",
+                    }
+                },
+                "/router": {
+                    "post": {
+                        "summary": "Post Router",
+                        "operationId": "baz_post_router",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response 404 Baz Post Router",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                                        "$ref": "#/components/schemas/Body_baz_post_router"
                                     }
                                 }
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Baz Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Baz Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_baz_post_router": {
-                    "title": "Body_baz_post_router",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_foo_post_root": {
-                    "title": "Body_foo_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
+                    }
                 },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_baz_post_router": {
+                        "title": "Body_baz_post_router",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_foo_post_root": {
+                        "title": "Body_foo_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_app_path_operation_overrides_generate_unique_id():
@@ -1143,190 +1181,197 @@ def test_app_path_operation_overrides_generate_unique_id():
     app.include_router(router)
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "baz_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_baz_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "baz_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Baz Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_baz_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Baz Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Baz Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Baz Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                    },
-                }
-            },
-            "/router": {
-                "post": {
-                    "summary": "Post Router",
-                    "operationId": "bar_post_router",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_bar_post_router"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Bar Post Router",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                        "404": {
-                            "description": "Not Found",
+                    }
+                },
+                "/router": {
+                    "post": {
+                        "summary": "Post Router",
+                        "operationId": "bar_post_router",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response 404 Bar Post Router",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                                        "$ref": "#/components/schemas/Body_bar_post_router"
                                     }
                                 }
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Bar Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Bar Post Router",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_bar_post_router": {
-                    "title": "Body_bar_post_router",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_baz_post_root": {
-                    "title": "Body_baz_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
+                    }
                 },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_bar_post_router": {
+                        "title": "Body_bar_post_router",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_baz_post_root": {
+                        "title": "Body_baz_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_callback_override_generate_unique_id():
@@ -1362,259 +1407,266 @@ def test_callback_override_generate_unique_id():
 
     client = TestClient(app)
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "post": {
-                    "summary": "Post Root",
-                    "operationId": "baz_post_root",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_baz_post_root"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "post": {
+                        "summary": "Post Root",
+                        "operationId": "baz_post_root",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Baz Post Root",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_baz_post_root"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Baz Post Root",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Baz Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Baz Post Root",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                    "callbacks": {
-                        "post_callback": {
-                            "/post-callback": {
-                                "post": {
-                                    "summary": "Post Callback",
-                                    "operationId": "baz_post_callback",
-                                    "requestBody": {
-                                        "content": {
-                                            "application/json": {
-                                                "schema": {
-                                                    "$ref": "#/components/schemas/Body_baz_post_callback"
-                                                }
-                                            }
-                                        },
-                                        "required": True,
-                                    },
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
+                        "callbacks": {
+                            "post_callback": {
+                                "/post-callback": {
+                                    "post": {
+                                        "summary": "Post Callback",
+                                        "operationId": "baz_post_callback",
+                                        "requestBody": {
                                             "content": {
                                                 "application/json": {
                                                     "schema": {
-                                                        "title": "Response Baz Post Callback",
-                                                        "type": "array",
-                                                        "items": {
-                                                            "$ref": "#/components/schemas/Item"
-                                                        },
+                                                        "$ref": "#/components/schemas/Body_baz_post_callback"
                                                     }
                                                 }
                                             },
+                                            "required": True,
                                         },
-                                        "404": {
-                                            "description": "Not Found",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "title": "Response 404 Baz Post Callback",
-                                                        "type": "array",
-                                                        "items": {
-                                                            "$ref": "#/components/schemas/Message"
-                                                        },
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "title": "Response Baz Post Callback",
+                                                            "type": "array",
+                                                            "items": {
+                                                                "$ref": "#/components/schemas/Item"
+                                                            },
+                                                        }
                                                     }
-                                                }
+                                                },
                                             },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                            "404": {
+                                                "description": "Not Found",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "title": "Response 404 Baz Post Callback",
+                                                            "type": "array",
+                                                            "items": {
+                                                                "$ref": "#/components/schemas/Message"
+                                                            },
+                                                        }
                                                     }
-                                                }
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        }
-                    },
-                }
-            },
-            "/tocallback": {
-                "post": {
-                    "summary": "Post With Callback",
-                    "operationId": "foo_post_with_callback",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_foo_post_with_callback"
+                                    }
                                 }
                             }
                         },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    }
+                },
+                "/tocallback": {
+                    "post": {
+                        "summary": "Post With Callback",
+                        "operationId": "foo_post_with_callback",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "title": "Response Foo Post With Callback",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "$ref": "#/components/schemas/Body_foo_post_with_callback"
                                     }
                                 }
                             },
-                        },
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 404 Foo Post With Callback",
-                                        "type": "array",
-                                        "items": {
-                                            "$ref": "#/components/schemas/Message"
-                                        },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Foo Post With Callback",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 404 Foo Post With Callback",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Message"
+                                            },
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_baz_post_callback": {
-                    "title": "Body_baz_post_callback",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_baz_post_root": {
-                    "title": "Body_baz_post_root",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
-                },
-                "Body_foo_post_with_callback": {
-                    "title": "Body_foo_post_with_callback",
-                    "required": ["item1", "item2"],
-                    "type": "object",
-                    "properties": {
-                        "item1": {"$ref": "#/components/schemas/Item"},
-                        "item2": {"$ref": "#/components/schemas/Item"},
-                    },
+                    }
                 },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["title", "description"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_baz_post_callback": {
+                        "title": "Body_baz_post_callback",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_baz_post_root": {
+                        "title": "Body_baz_post_root",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "Body_foo_post_with_callback": {
+                        "title": "Body_foo_post_with_callback",
+                        "required": ["item1", "item2"],
+                        "type": "object",
+                        "properties": {
+                            "item1": {"$ref": "#/components/schemas/Item"},
+                            "item2": {"$ref": "#/components/schemas/Item"},
+                        },
+                    },
+                    "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": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["title", "description"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
 
 
 def test_warn_duplicate_operation_id():
index 93b72ad243468b4ba04a51b89ba65a1cfa3cc6b7..96c7a71265e3683705b769806016f0b04498448f 100644 (file)
@@ -2,6 +2,7 @@ from typing import Annotated, TypeVar
 
 from fastapi import Depends, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -44,33 +45,35 @@ def test_generic_parameterless_depends():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "openapi": "3.1.0",
-        "paths": {
-            "/a": {
-                "get": {
-                    "operationId": "a_a_get",
-                    "responses": {
-                        "200": {
-                            "content": {"application/json": {"schema": {}}},
-                            "description": "Successful Response",
-                        }
-                    },
-                    "summary": "A",
-                }
+    assert response.json() == snapshot(
+        {
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "openapi": "3.1.0",
+            "paths": {
+                "/a": {
+                    "get": {
+                        "operationId": "a_a_get",
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            }
+                        },
+                        "summary": "A",
+                    }
+                },
+                "/b": {
+                    "get": {
+                        "operationId": "b_b_get",
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            }
+                        },
+                        "summary": "B",
+                    }
+                },
             },
-            "/b": {
-                "get": {
-                    "operationId": "b_b_get",
-                    "responses": {
-                        "200": {
-                            "content": {"application/json": {"schema": {}}},
-                            "description": "Successful Response",
-                        }
-                    },
-                    "summary": "B",
-                }
-            },
-        },
-    }
+        }
+    )
index b21889e30f2ad52e4f28ab4fe2681226a4c8f66d..1b0f4970b76d0cc9172adc32a8c335718b6aea11 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -28,82 +29,86 @@ def test_get_with_body():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/product": {
-                "get": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_product_get",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Product"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/product": {
+                    "get": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_product_get",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Product"}
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Product": {
-                    "title": "Product",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
+                    "Product": {
+                        "title": "Product",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6d2ffc44a539ff78e9368775420586e772822518..e8303c8218bc787ab90acdcb457e0b10db93ea2f 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from fastapi import APIRouter, Depends, FastAPI, Response
 from fastapi.responses import JSONResponse
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 class ResponseLevel0(JSONResponse):
@@ -442,6858 +443,6862 @@ def test_openapi():
         response = client.get("/openapi.json")
         assert issubclass(w[-1].category, UserWarning)
         assert "Duplicate Operation ID" in str(w[-1].message)
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/override1": {
-                "get": {
-                    "tags": ["path1a", "path1b"],
-                    "summary": "Path1 Override",
-                    "operationId": "path1_override_override1_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level1", "type": "string"},
-                            "name": "level1",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-1": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/override1": {
+                    "get": {
+                        "tags": ["path1a", "path1b"],
+                        "summary": "Path1 Override",
+                        "operationId": "path1_override_override1_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level1", "type": "string"},
+                                "name": "level1",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-1": {"schema": {}}},
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/default1": {
+                    "get": {
+                        "summary": "Path1 Default",
+                        "operationId": "path1_default_default1_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level1", "type": "string"},
+                                "name": "level1",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-0": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
                             }
                         },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/default1": {
-                "get": {
-                    "summary": "Path1 Default",
-                    "operationId": "path1_default_default1_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level1", "type": "string"},
-                            "name": "level1",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-0": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
+                    }
+                },
+                "/level1/level2/override3": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "path3a",
+                            "path3b",
+                        ],
+                        "summary": "Path3 Override Router2 Override",
+                        "operationId": "path3_override_router2_override_level1_level2_override3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        }
-                    },
-                }
-            },
-            "/level1/level2/override3": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "path3a",
-                        "path3b",
-                    ],
-                    "summary": "Path3 Override Router2 Override",
-                    "operationId": "path3_override_router2_override_level1_level2_override3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/default3": {
+                    "get": {
+                        "tags": ["level1a", "level1b", "level2a", "level2b"],
+                        "summary": "Path3 Default Router2 Override",
+                        "operationId": "path3_default_router2_override_level1_level2_default3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-2": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/level3/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level1_level2_level3_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/default3": {
-                "get": {
-                    "tags": ["level1a", "level1b", "level2a", "level2b"],
-                    "summary": "Path3 Default Router2 Override",
-                    "operationId": "path3_default_router2_override_level1_level2_default3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-2": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/level3/level4/default5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                        ],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level1_level2_level3_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/level3/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level1_level2_level3_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                        },
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/level3/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level1_level2_level3_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                        },
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/level3/default5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                        ],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level1_level2_level3_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level1_level2_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/level3/level4/default5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                    ],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level1_level2_level3_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                        },
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/level4/default5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "level4a",
+                            "level4b",
+                        ],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level1_level2_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level2a",
+                            "level2b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level1_level2_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/level3/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level1_level2_level3_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/level3/default5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                    ],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level1_level2_level3_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level1_level2_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/level4/default5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "level4a",
-                        "level4b",
-                    ],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level1_level2_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level2a",
-                        "level2b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level1_level2_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level2/default5": {
-                "get": {
-                    "tags": ["level1a", "level1b", "level2a", "level2b"],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level1_level2_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-2": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "402": {"description": "Client error level 2"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "502": {"description": "Server error level 2"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/override3": {
-                "get": {
-                    "tags": ["level1a", "level1b", "path3a", "path3b"],
-                    "summary": "Path3 Override Router2 Default",
-                    "operationId": "path3_override_router2_default_level1_override3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/default3": {
-                "get": {
-                    "tags": ["level1a", "level1b"],
-                    "summary": "Path3 Default Router2 Default",
-                    "operationId": "path3_default_router2_default_level1_default3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-1": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                }
-            },
-            "/level1/level3/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level1_level3_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level3/level4/default5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                    ],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level1_level3_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level3/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level3a",
-                        "level3b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level1_level3_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "403": {"description": "Client error level 3"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "503": {"description": "Server error level 3"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level3/default5": {
-                "get": {
-                    "tags": ["level1a", "level1b", "level3a", "level3b"],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level1_level3_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                }
-            },
-            "/level1/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level1a",
-                        "level1b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level1_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/level4/default5": {
-                "get": {
-                    "tags": ["level1a", "level1b", "level4a", "level4b"],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level1_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/override5": {
-                "get": {
-                    "tags": ["level1a", "level1b", "path5a", "path5b"],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level1_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level1/default5": {
-                "get": {
-                    "tags": ["level1a", "level1b"],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level1_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-1": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "401": {"description": "Client error level 1"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "501": {"description": "Server error level 1"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                        "callback1": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback1",
-                                    "operationId": "callback1__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level1",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level1",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                }
-            },
-            "/level2/override3": {
-                "get": {
-                    "tags": ["level2a", "level2b", "path3a", "path3b"],
-                    "summary": "Path3 Override Router2 Override",
-                    "operationId": "path3_override_router2_override_level2_override3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level2/default5": {
+                    "get": {
+                        "tags": ["level1a", "level1b", "level2a", "level2b"],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level1_level2_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-2": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "402": {"description": "Client error level 2"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "502": {"description": "Server error level 2"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/default3": {
-                "get": {
-                    "tags": ["level2a", "level2b"],
-                    "summary": "Path3 Default Router2 Override",
-                    "operationId": "path3_default_router2_override_level2_default3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-2": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/override3": {
+                    "get": {
+                        "tags": ["level1a", "level1b", "path3a", "path3b"],
+                        "summary": "Path3 Override Router2 Default",
+                        "operationId": "path3_override_router2_default_level1_override3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/level3/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level2_level3_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/default3": {
+                    "get": {
+                        "tags": ["level1a", "level1b"],
+                        "summary": "Path3 Default Router2 Default",
+                        "operationId": "path3_default_router2_default_level1_default3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-1": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
+                    }
+                },
+                "/level1/level3/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level1_level3_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/level3/level4/default5": {
-                "get": {
-                    "tags": [
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                    ],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level2_level3_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level3/level4/default5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                        ],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level1_level3_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/level3/override5": {
-                "get": {
-                    "tags": [
-                        "level2a",
-                        "level2b",
-                        "level3a",
-                        "level3b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level2_level3_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level3/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level3a",
+                            "level3b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level1_level3_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "403": {"description": "Client error level 3"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "503": {"description": "Server error level 3"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/level3/default5": {
-                "get": {
-                    "tags": ["level2a", "level2b", "level3a", "level3b"],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level2_level3_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level3/default5": {
+                    "get": {
+                        "tags": ["level1a", "level1b", "level3a", "level3b"],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level1_level3_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level2a",
-                        "level2b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level2_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
+                    }
+                },
+                "/level1/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level1a",
+                            "level1b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level1_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/level4/default5": {
+                    "get": {
+                        "tags": ["level1a", "level1b", "level4a", "level4b"],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level1_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/level4/default5": {
-                "get": {
-                    "tags": ["level2a", "level2b", "level4a", "level4b"],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level2_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
+                                            },
+                                        },
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/override5": {
+                    "get": {
+                        "tags": ["level1a", "level1b", "path5a", "path5b"],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level1_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
+                                        },
+                                    }
+                                }
+                            },
+                        },
+                        "deprecated": True,
+                    }
+                },
+                "/level1/default5": {
+                    "get": {
+                        "tags": ["level1a", "level1b"],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level1_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-1": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "401": {"description": "Client error level 1"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "501": {"description": "Server error level 1"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback1": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback1",
+                                        "operationId": "callback1__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level1",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level1",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
+                    }
+                },
+                "/level2/override3": {
+                    "get": {
+                        "tags": ["level2a", "level2b", "path3a", "path3b"],
+                        "summary": "Path3 Override Router2 Override",
+                        "operationId": "path3_override_router2_override_level2_override3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/override5": {
-                "get": {
-                    "tags": ["level2a", "level2b", "path5a", "path5b"],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level2_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
+                                            },
+                                        },
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/default3": {
+                    "get": {
+                        "tags": ["level2a", "level2b"],
+                        "summary": "Path3 Default Router2 Override",
+                        "operationId": "path3_default_router2_override_level2_default3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-2": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/level3/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level2_level3_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level2/default5": {
-                "get": {
-                    "tags": ["level2a", "level2b"],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level2_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-2": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "402": {"description": "Client error level 2"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
+                                            },
+                                        },
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "502": {"description": "Server error level 2"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/level3/level4/default5": {
+                    "get": {
+                        "tags": [
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                        ],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level2_level3_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback2": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback2",
-                                    "operationId": "callback2__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level2",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level2",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/override3": {
-                "get": {
-                    "tags": ["path3a", "path3b"],
-                    "summary": "Path3 Override Router2 Default",
-                    "operationId": "path3_override_router2_default_override3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/level3/override5": {
+                    "get": {
+                        "tags": [
+                            "level2a",
+                            "level2b",
+                            "level3a",
+                            "level3b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level2_level3_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/default3": {
-                "get": {
-                    "summary": "Path3 Default Router2 Default",
-                    "operationId": "path3_default_router2_default_default3_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level3", "type": "string"},
-                            "name": "level3",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-0": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/level3/default5": {
+                    "get": {
+                        "tags": ["level2a", "level2b", "level3a", "level3b"],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level2_level3_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        }
-                    },
-                }
-            },
-            "/level3/level4/override5": {
-                "get": {
-                    "tags": [
-                        "level3a",
-                        "level3b",
-                        "level4a",
-                        "level4b",
-                        "path5a",
-                        "path5b",
-                    ],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level3_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level2a",
+                            "level2b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level2_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/level4/default5": {
+                    "get": {
+                        "tags": ["level2a", "level2b", "level4a", "level4b"],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level2_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level3/level4/default5": {
-                "get": {
-                    "tags": ["level3a", "level3b", "level4a", "level4b"],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level3_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "403": {"description": "Client error level 3"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
+                                            },
+                                        },
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "503": {"description": "Server error level 3"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/override5": {
+                    "get": {
+                        "tags": ["level2a", "level2b", "path5a", "path5b"],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level2_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level2/default5": {
+                    "get": {
+                        "tags": ["level2a", "level2b"],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level2_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-2": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "402": {"description": "Client error level 2"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "502": {"description": "Server error level 2"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback2": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback2",
+                                        "operationId": "callback2__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level2",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level2",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level3/override5": {
-                "get": {
-                    "tags": ["level3a", "level3b", "path5a", "path5b"],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_level3_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "403": {"description": "Client error level 3"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "503": {"description": "Server error level 3"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/override3": {
+                    "get": {
+                        "tags": ["path3a", "path3b"],
+                        "summary": "Path3 Override Router2 Default",
+                        "operationId": "path3_override_router2_default_override3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/default3": {
+                    "get": {
+                        "summary": "Path3 Default Router2 Default",
+                        "operationId": "path3_default_router2_default_default3_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level3", "type": "string"},
+                                "name": "level3",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-0": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
                             }
                         },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
+                    }
+                },
+                "/level3/level4/override5": {
+                    "get": {
+                        "tags": [
+                            "level3a",
+                            "level3b",
+                            "level4a",
+                            "level4b",
+                            "path5a",
+                            "path5b",
+                        ],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level3_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level3/default5": {
-                "get": {
-                    "tags": ["level3a", "level3b"],
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_level3_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-3": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "403": {"description": "Client error level 3"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "503": {"description": "Server error level 3"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback3": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback3",
-                                    "operationId": "callback3__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level3",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level3",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level3/level4/default5": {
+                    "get": {
+                        "tags": ["level3a", "level3b", "level4a", "level4b"],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level3_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "403": {"description": "Client error level 3"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "503": {"description": "Server error level 3"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                }
-            },
-            "/level4/override5": {
-                "get": {
-                    "tags": ["level4a", "level4b", "path5a", "path5b"],
-                    "summary": "Path5 Override Router4 Override",
-                    "operationId": "path5_override_router4_override_level4_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "404": {"description": "Client error level 4"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
-                        },
-                        "500": {"description": "Server error level 0"},
-                        "504": {"description": "Server error level 4"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level3/override5": {
+                    "get": {
+                        "tags": ["level3a", "level3b", "path5a", "path5b"],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_level3_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "403": {"description": "Client error level 3"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "503": {"description": "Server error level 3"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
-                                        }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/level4/default5": {
-                "get": {
-                    "tags": ["level4a", "level4b"],
-                    "summary": "Path5 Default Router4 Override",
-                    "operationId": "path5_default_router4_override_level4_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-4": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "404": {"description": "Client error level 4"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "504": {"description": "Server error level 4"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level3/default5": {
+                    "get": {
+                        "tags": ["level3a", "level3b"],
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_level3_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-3": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "403": {"description": "Client error level 3"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "503": {"description": "Server error level 3"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback3": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback3",
+                                        "operationId": "callback3__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level3",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level3",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback4": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback4",
-                                    "operationId": "callback4__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level4",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level4",
-                                                "type": "string",
-                                            },
+                    }
+                },
+                "/level4/override5": {
+                    "get": {
+                        "tags": ["level4a", "level4b", "path5a", "path5b"],
+                        "summary": "Path5 Override Router4 Override",
+                        "operationId": "path5_override_router4_override_level4_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "404": {"description": "Client error level 4"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "504": {"description": "Server error level 4"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/override5": {
-                "get": {
-                    "tags": ["path5a", "path5b"],
-                    "summary": "Path5 Override Router4 Default",
-                    "operationId": "path5_override_router4_default_override5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-5": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "405": {"description": "Client error level 5"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
+                                            },
+                                        },
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                        "505": {"description": "Server error level 5"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/level4/default5": {
+                    "get": {
+                        "tags": ["level4a", "level4b"],
+                        "summary": "Path5 Default Router4 Override",
+                        "operationId": "path5_default_router4_override_level4_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-4": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "404": {"description": "Client error level 4"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "504": {"description": "Server error level 4"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback4": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback4",
+                                        "operationId": "callback4__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level4",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level4",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
+                                    }
                                 }
-                            }
+                            },
                         },
-                        "callback5": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback5",
-                                    "operationId": "callback5__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level5",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level5",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/override5": {
+                    "get": {
+                        "tags": ["path5a", "path5b"],
+                        "summary": "Path5 Override Router4 Default",
+                        "operationId": "path5_override_router4_default_override5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-5": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "405": {"description": "Client error level 5"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                            "505": {"description": "Server error level 5"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                }
+                            },
+                            "callback5": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback5",
+                                        "operationId": "callback5__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level5",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level5",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {"schema": {}}
+                                                },
+                                            },
+                                            "422": {
+                                                "description": "Validation Error",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                        }
+                                                    }
+                                                },
                                             },
                                         },
-                                    },
-                                }
-                            }
-                        },
-                    },
-                    "deprecated": True,
-                }
-            },
-            "/default5": {
-                "get": {
-                    "summary": "Path5 Default Router4 Default",
-                    "operationId": "path5_default_router4_default_default5_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Level5", "type": "string"},
-                            "name": "level5",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/x-level-0": {"schema": {}}},
-                        },
-                        "400": {"description": "Client error level 0"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
                                     }
                                 }
                             },
                         },
-                        "500": {"description": "Server error level 0"},
-                    },
-                    "callbacks": {
-                        "callback0": {
-                            "/": {
-                                "get": {
-                                    "summary": "Callback0",
-                                    "operationId": "callback0__get",
-                                    "parameters": [
-                                        {
-                                            "name": "level0",
-                                            "in": "query",
-                                            "required": True,
-                                            "schema": {
-                                                "title": "Level0",
-                                                "type": "string",
-                                            },
+                        "deprecated": True,
+                    }
+                },
+                "/default5": {
+                    "get": {
+                        "summary": "Path5 Default Router4 Default",
+                        "operationId": "path5_default_router4_default_default5_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Level5", "type": "string"},
+                                "name": "level5",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/x-level-0": {"schema": {}}},
+                            },
+                            "400": {"description": "Client error level 0"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
                                         }
-                                    ],
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
-                                            "content": {
-                                                "application/json": {"schema": {}}
-                                            },
-                                        },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                                    }
-                                                }
+                                    }
+                                },
+                            },
+                            "500": {"description": "Server error level 0"},
+                        },
+                        "callbacks": {
+                            "callback0": {
+                                "/": {
+                                    "get": {
+                                        "summary": "Callback0",
+                                        "operationId": "callback0__get",
+                                        "parameters": [
+                                            {
+                                                "name": "level0",
+                                                "in": "query",
+                                                "required": True,
+                                                "schema": {
+                                                    "title": "Level0",
+                                                    "type": "string",
+                                                },
+                                            }
+                                        ],
+                                        "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"},
-                        }
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index b11a1ca4332df8623b539c8815b0dc1f00c0cd5a..bb20a4a1aa98c66bab561cee1b68628946febb80 100644 (file)
@@ -2,6 +2,7 @@ from typing import Optional
 
 from fastapi import APIRouter, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -107,228 +108,232 @@ def test_get_users_item():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/": {
-                "get": {
-                    "summary": "Get Users",
-                    "operationId": "get_users_users__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/users/{user_id}": {
-                "get": {
-                    "summary": "Get User",
-                    "operationId": "get_user_users__user_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "User Id", "type": "string"},
-                            "name": "user_id",
-                            "in": "path",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/": {
+                    "get": {
+                        "summary": "Get Users",
+                        "operationId": "get_users_users__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/users/{user_id}": {
+                    "get": {
+                        "summary": "Get User",
+                        "operationId": "get_user_users__user_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "User Id", "type": "string"},
+                                "name": "user_id",
+                                "in": "path",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/items/": {
-                "get": {
-                    "summary": "Get Items",
-                    "operationId": "get_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "name": "user_id",
-                            "in": "query",
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "User Id",
+                    }
+                },
+                "/items/": {
+                    "get": {
+                        "summary": "Get Items",
+                        "operationId": "get_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "name": "user_id",
+                                "in": "query",
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "User Id",
+                                },
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Get Item",
-                    "operationId": "get_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "name": "user_id",
-                            "in": "query",
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "User Id",
+                    }
+                },
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Get Item",
+                        "operationId": "get_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            {
+                                "required": False,
+                                "name": "user_id",
+                                "in": "query",
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "User Id",
+                                },
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/users/{user_id}/items/": {
-                "get": {
-                    "summary": "Get Items",
-                    "operationId": "get_items_users__user_id__items__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "name": "user_id",
-                            "in": "path",
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "User Id",
+                    }
+                },
+                "/users/{user_id}/items/": {
+                    "get": {
+                        "summary": "Get Items",
+                        "operationId": "get_items_users__user_id__items__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "name": "user_id",
+                                "in": "path",
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "User Id",
+                                },
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/users/{user_id}/items/{item_id}": {
-                "get": {
-                    "summary": "Get Item",
-                    "operationId": "get_item_users__user_id__items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "name": "user_id",
-                            "in": "path",
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "User Id",
+                    }
+                },
+                "/users/{user_id}/items/{item_id}": {
+                    "get": {
+                        "summary": "Get Item",
+                        "operationId": "get_item_users__user_id__items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            {
+                                "required": True,
+                                "name": "user_id",
+                                "in": "path",
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "User Id",
+                                },
+                            },
+                        ],
+                        "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"},
-                        }
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 276de539db4f14abdf980610c266cd55efe17a62..72707993e0923e1608d23f6e5e9cdad13a154be8 100644 (file)
@@ -1,5 +1,6 @@
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from .app.main import app
 
@@ -28,124 +29,128 @@ def test_post_invalid(path):
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a/compute": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a/compute": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Compute",
+                        "operationId": "compute_a_compute_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_compute_a_compute_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Compute",
-                    "operationId": "compute_a_compute_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_compute_a_compute_post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                }
-            },
-            "/b/compute/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/b/compute/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Compute",
+                        "operationId": "compute_b_compute__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_compute_b_compute__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Compute",
-                    "operationId": "compute_b_compute__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_compute_b_compute__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                }
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_compute_b_compute__post": {
-                    "title": "Body_compute_b_compute__post",
-                    "required": ["a", "b"],
-                    "type": "object",
-                    "properties": {
-                        "a": {"title": "A", "type": "integer"},
-                        "b": {"title": "B", "type": "string"},
+            "components": {
+                "schemas": {
+                    "Body_compute_b_compute__post": {
+                        "title": "Body_compute_b_compute__post",
+                        "required": ["a", "b"],
+                        "type": "object",
+                        "properties": {
+                            "a": {"title": "A", "type": "integer"},
+                            "b": {"title": "B", "type": "string"},
+                        },
                     },
-                },
-                "Body_compute_a_compute_post": {
-                    "title": "Body_compute_a_compute_post",
-                    "required": ["a", "b"],
-                    "type": "object",
-                    "properties": {
-                        "a": {"title": "A", "type": "integer"},
-                        "b": {"title": "B", "type": "string"},
+                    "Body_compute_a_compute_post": {
+                        "title": "Body_compute_a_compute_post",
+                        "required": ["a", "b"],
+                        "type": "object",
+                        "properties": {
+                            "a": {"title": "A", "type": "integer"},
+                            "b": {"title": "B", "type": "string"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fa3e0c635902013eb403b16d1968b11385709f70..792471b5c1634838bb4dcd6702cebbe9655e4176 100644 (file)
@@ -89,99 +89,103 @@ def test_put_incorrect_body_multiple():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Save Item No Body",
+                        "operationId": "save_item_no_body_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Item",
+                                        "type": "array",
+                                        "items": {"$ref": "#/components/schemas/Item"},
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Save Item No Body",
-                    "operationId": "save_item_no_body_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Item",
-                                    "type": "array",
-                                    "items": {"$ref": "#/components/schemas/Item"},
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "age"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "age": {
-                            "title": "Age",
-                            "anyOf": [
-                                {"exclusiveMinimum": 0.0, "type": "number"},
-                                IsOneOf(
-                                    # pydantic < 2.12.0
-                                    {"type": "string"},
-                                    # pydantic >= 2.12.0
-                                    {
-                                        "type": "string",
-                                        "pattern": r"^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$",
-                                    },
-                                ),
-                            ],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "age"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "age": {
+                                "title": "Age",
+                                "anyOf": [
+                                    {"exclusiveMinimum": 0.0, "type": "number"},
+                                    IsOneOf(
+                                        # pydantic < 2.12.0
+                                        {"type": "string"},
+                                        # pydantic >= 2.12.0
+                                        {
+                                            "type": "string",
+                                            "pattern": r"^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$",
+                                        },
+                                    ),
+                                ],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 7540367a6f8ea6985f32d45af0db59391ebdcd75..060951efa47aaa8aaecc00d5971a4a4e58693257 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -42,76 +43,80 @@ def test_multi_query_incorrect():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Q",
-                                "type": "array",
-                                "items": {"type": "integer"},
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Q",
+                                    "type": "array",
+                                    "items": {"type": "integer"},
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 93e5b366f163fbefc2dc25e3a939188616645fc5..deb74d8a0fa5b32229a6807612d6bedb3e9f1b91 100644 (file)
@@ -2,6 +2,7 @@ from typing import Union
 
 from fastapi import Body, Cookie, FastAPI, Header, Path, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -143,277 +144,281 @@ def test_call_api():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/examples/": {
-                "post": {
-                    "summary": "Examples",
-                    "operationId": "examples_examples__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/examples/": {
+                    "post": {
+                        "summary": "Examples",
+                        "operationId": "examples_examples__post",
+                        "requestBody": {
+                            "content": {
+                                "application/json": {
+                                    "schema": {
+                                        "$ref": "#/components/schemas/Item",
+                                        "examples": [
+                                            {"data": "Data in Body examples, example1"}
+                                        ],
+                                    },
+                                    "examples": {
+                                        "Example One": {
+                                            "summary": "Example One Summary",
+                                            "description": "Example One Description",
+                                            "value": {
+                                                "data": "Data in Body examples, example1"
+                                            },
+                                        },
+                                        "Example Two": {
+                                            "value": {
+                                                "data": "Data in Body examples, example2"
+                                            }
+                                        },
+                                    },
+                                }
+                            },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
+                "/path_examples/{item_id}": {
+                    "get": {
+                        "summary": "Path Examples",
+                        "operationId": "path_examples_path_examples__item_id__get",
+                        "parameters": [
+                            {
+                                "name": "item_id",
+                                "in": "path",
+                                "required": True,
                                 "schema": {
-                                    "$ref": "#/components/schemas/Item",
+                                    "type": "string",
                                     "examples": [
-                                        {"data": "Data in Body examples, example1"}
+                                        "json_schema_item_1",
+                                        "json_schema_item_2",
                                     ],
+                                    "title": "Item Id",
                                 },
                                 "examples": {
-                                    "Example One": {
-                                        "summary": "Example One Summary",
-                                        "description": "Example One Description",
-                                        "value": {
-                                            "data": "Data in Body examples, example1"
-                                        },
-                                    },
-                                    "Example Two": {
-                                        "value": {
-                                            "data": "Data in Body examples, example2"
-                                        }
+                                    "Path One": {
+                                        "summary": "Path One Summary",
+                                        "description": "Path One Description",
+                                        "value": "item_1",
                                     },
+                                    "Path Two": {"value": "item_2"},
                                 },
                             }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/path_examples/{item_id}": {
-                "get": {
-                    "summary": "Path Examples",
-                    "operationId": "path_examples_path_examples__item_id__get",
-                    "parameters": [
-                        {
-                            "name": "item_id",
-                            "in": "path",
-                            "required": True,
-                            "schema": {
-                                "type": "string",
-                                "examples": [
-                                    "json_schema_item_1",
-                                    "json_schema_item_2",
-                                ],
-                                "title": "Item Id",
-                            },
-                            "examples": {
-                                "Path One": {
-                                    "summary": "Path One Summary",
-                                    "description": "Path One Description",
-                                    "value": "item_1",
+                    }
+                },
+                "/query_examples/": {
+                    "get": {
+                        "summary": "Query Examples",
+                        "operationId": "query_examples_query_examples__get",
+                        "parameters": [
+                            {
+                                "name": "data",
+                                "in": "query",
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "examples": [
+                                        "json_schema_query1",
+                                        "json_schema_query2",
+                                    ],
+                                    "title": "Data",
+                                },
+                                "examples": {
+                                    "Query One": {
+                                        "summary": "Query One Summary",
+                                        "description": "Query One Description",
+                                        "value": "query1",
+                                    },
+                                    "Query Two": {"value": "query2"},
                                 },
-                                "Path Two": {"value": "item_2"},
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/query_examples/": {
-                "get": {
-                    "summary": "Query Examples",
-                    "operationId": "query_examples_query_examples__get",
-                    "parameters": [
-                        {
-                            "name": "data",
-                            "in": "query",
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "examples": [
-                                    "json_schema_query1",
-                                    "json_schema_query2",
-                                ],
-                                "title": "Data",
-                            },
-                            "examples": {
-                                "Query One": {
-                                    "summary": "Query One Summary",
-                                    "description": "Query One Description",
-                                    "value": "query1",
+                    }
+                },
+                "/header_examples/": {
+                    "get": {
+                        "summary": "Header Examples",
+                        "operationId": "header_examples_header_examples__get",
+                        "parameters": [
+                            {
+                                "name": "data",
+                                "in": "header",
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "examples": [
+                                        "json_schema_header1",
+                                        "json_schema_header2",
+                                    ],
+                                    "title": "Data",
                                 },
-                                "Query Two": {"value": "query2"},
+                                "examples": {
+                                    "Header One": {
+                                        "summary": "Header One Summary",
+                                        "description": "Header One Description",
+                                        "value": "header1",
+                                    },
+                                    "Header Two": {"value": "header2"},
+                                },
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/header_examples/": {
-                "get": {
-                    "summary": "Header Examples",
-                    "operationId": "header_examples_header_examples__get",
-                    "parameters": [
-                        {
-                            "name": "data",
-                            "in": "header",
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "examples": [
-                                    "json_schema_header1",
-                                    "json_schema_header2",
-                                ],
-                                "title": "Data",
-                            },
-                            "examples": {
-                                "Header One": {
-                                    "summary": "Header One Summary",
-                                    "description": "Header One Description",
-                                    "value": "header1",
+                    }
+                },
+                "/cookie_examples/": {
+                    "get": {
+                        "summary": "Cookie Examples",
+                        "operationId": "cookie_examples_cookie_examples__get",
+                        "parameters": [
+                            {
+                                "name": "data",
+                                "in": "cookie",
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "examples": [
+                                        "json_schema_cookie1",
+                                        "json_schema_cookie2",
+                                    ],
+                                    "title": "Data",
+                                },
+                                "examples": {
+                                    "Cookie One": {
+                                        "summary": "Cookie One Summary",
+                                        "description": "Cookie One Description",
+                                        "value": "cookie1",
+                                    },
+                                    "Cookie Two": {"value": "cookie2"},
                                 },
-                                "Header Two": {"value": "header2"},
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
+                    }
+                },
             },
-            "/cookie_examples/": {
-                "get": {
-                    "summary": "Cookie Examples",
-                    "operationId": "cookie_examples_cookie_examples__get",
-                    "parameters": [
-                        {
-                            "name": "data",
-                            "in": "cookie",
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "examples": [
-                                    "json_schema_cookie1",
-                                    "json_schema_cookie2",
-                                ],
-                                "title": "Data",
-                            },
-                            "examples": {
-                                "Cookie One": {
-                                    "summary": "Cookie One Summary",
-                                    "description": "Cookie One Description",
-                                    "value": "cookie1",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
                                 },
-                                "Cookie Two": {"value": "cookie2"},
-                            },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
-                            },
+                                "type": "array",
+                                "title": "Detail",
+                            }
                         },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+                    "Item": {
+                        "properties": {"data": {"type": "string", "title": "Data"}},
+                        "type": "object",
+                        "required": ["data"],
+                        "title": "Item",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {"data": {"type": "string", "title": "Data"}},
-                    "type": "object",
-                    "required": ["data"],
-                    "title": "Item",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index b6c3c3d8da6e3846864a3fe141140174f8291ea8..836a0a7ee5719af70f37b0ded73b18e35fc4a5dd 100644 (file)
@@ -2,6 +2,7 @@ from typing import Optional
 
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -41,88 +42,92 @@ def test_get_route():
 def test_openapi():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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",
+    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",
                             },
-                            "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"
+                            {
+                                "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 3a3099436799cb90110a0589a3f08deb978ba465..fc11b69c81011af4a952c38cd9a751e491f5f1eb 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -18,25 +19,27 @@ def test_get_route():
     assert response.json() == {}
 
 
-def test_openapi():
+def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
                         },
-                    },
-                    "summary": "Route With Extras",
-                    "operationId": "route_with_extras__get",
-                    "x-custom-extension": "value",
-                }
+                        "summary": "Route With Extras",
+                        "operationId": "route_with_extras__get",
+                        "x-custom-extension": "value",
+                    }
+                },
             },
-        },
-    }
+        }
+    )
index f941e323bfcaf0e76acca120a72355d863df2014..0efeece01734d55e8e06fb8befbdbab6a5ae61a8 100644 (file)
@@ -444,229 +444,235 @@ def test_openapi_schema_no_separate():
     client = get_app_client(separate_input_output_schemas=False)
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "items": {"$ref": "#/components/schemas/Item"},
-                                        "type": "array",
-                                        "title": "Response Read Items Items  Get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                            "type": "array",
+                                            "title": "Response Read Items Items  Get",
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                },
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+                                },
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "402": {
-                            "description": "Payment Required",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "402": {
+                                "description": "Payment Required",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
-            },
-            "/items-list/": {
-                "post": {
-                    "summary": "Create Item List",
-                    "operationId": "create_item_list_items_list__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "items": {"$ref": "#/components/schemas/Item"},
-                                    "type": "array",
-                                    "title": "Item",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                "/items-list/": {
+                    "post": {
+                        "summary": "Create Item List",
+                        "operationId": "create_item_list_items_list__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "items": {"$ref": "#/components/schemas/Item"},
+                                        "type": "array",
+                                        "title": "Item",
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/with-computed-field/": {
-                "post": {
-                    "summary": "Create With Computed Field",
-                    "operationId": "create_with_computed_field_with_computed_field__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/WithComputedField-Input"
-                                }
-                            }
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    }
+                },
+                "/with-computed-field/": {
+                    "post": {
+                        "summary": "Create With Computed Field",
+                        "operationId": "create_with_computed_field_with_computed_field__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/WithComputedField-Output"
+                                        "$ref": "#/components/schemas/WithComputedField-Input"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/WithComputedField-Output"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
-                    },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
-                        },
-                        "sub": {
-                            "anyOf": [
-                                {"$ref": "#/components/schemas/SubItem"},
-                                {"type": "null"},
-                            ]
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
                         },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "required": ["name"],
-                    "title": "Item",
-                },
-                "SubItem": {
-                    "properties": {
-                        "subname": {"type": "string", "title": "Subname"},
-                        "sub_description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Sub Description",
+                    "Item": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
+                            "sub": {
+                                "anyOf": [
+                                    {"$ref": "#/components/schemas/SubItem"},
+                                    {"type": "null"},
+                                ]
+                            },
                         },
-                        "tags": {
-                            "items": {"type": "string"},
-                            "type": "array",
-                            "title": "Tags",
-                            "default": [],
+                        "type": "object",
+                        "required": ["name"],
+                        "title": "Item",
+                    },
+                    "SubItem": {
+                        "properties": {
+                            "subname": {"type": "string", "title": "Subname"},
+                            "sub_description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Sub Description",
+                            },
+                            "tags": {
+                                "items": {"type": "string"},
+                                "type": "array",
+                                "title": "Tags",
+                                "default": [],
+                            },
                         },
+                        "type": "object",
+                        "required": ["subname"],
+                        "title": "SubItem",
                     },
-                    "type": "object",
-                    "required": ["subname"],
-                    "title": "SubItem",
-                },
-                "WithComputedField-Input": {
-                    "properties": {"name": {"type": "string", "title": "Name"}},
-                    "type": "object",
-                    "required": ["name"],
-                    "title": "WithComputedField",
-                },
-                "WithComputedField-Output": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "computed_field": {
-                            "type": "string",
-                            "title": "Computed Field",
-                            "readOnly": True,
+                    "WithComputedField-Input": {
+                        "properties": {"name": {"type": "string", "title": "Name"}},
+                        "type": "object",
+                        "required": ["name"],
+                        "title": "WithComputedField",
+                    },
+                    "WithComputedField-Output": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "computed_field": {
+                                "type": "string",
+                                "title": "Computed Field",
+                                "readOnly": True,
+                            },
                         },
+                        "type": "object",
+                        "required": ["name", "computed_field"],
+                        "title": "WithComputedField",
                     },
-                    "type": "object",
-                    "required": ["name", "computed_field"],
-                    "title": "WithComputedField",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
-                            },
-                            "type": "array",
-                            "title": "Location",
+                    "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"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6b1f660cb7b00f754e1bb9d4da111750caafa782..81178924bffaf4e5e522ee0c0b7654b8261d184b 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import Depends, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -23,73 +24,76 @@ def test_read_users():
 
 def test_openapi_schema():
     response = client.get("/openapi.json")
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/{user_id}": {
-                "get": {
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__user_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "User Id", "type": "integer"},
-                            "name": "user_id",
-                            "in": "path",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/{user_id}": {
+                    "get": {
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__user_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "User Id", "type": "integer"},
+                                "name": "user_id",
+                                "in": "path",
+                            },
+                        ],
+                        "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 5060920f14624aa0b76a359e455f7ee330d9a513..463fb51b10ef4842e45bc289c9ec46e5b52e5380 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 import pytest
 from fastapi import Cookie, FastAPI, Header, Path, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -33,140 +34,6 @@ async def hidden_query(
     return {"hidden_query": hidden_query}
 
 
-openapi_schema = {
-    "openapi": "3.1.0",
-    "info": {"title": "FastAPI", "version": "0.1.0"},
-    "paths": {
-        "/hidden_cookie": {
-            "get": {
-                "summary": "Hidden Cookie",
-                "operationId": "hidden_cookie_hidden_cookie_get",
-                "responses": {
-                    "200": {
-                        "description": "Successful Response",
-                        "content": {"application/json": {"schema": {}}},
-                    },
-                    "422": {
-                        "description": "Validation Error",
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/HTTPValidationError"
-                                }
-                            }
-                        },
-                    },
-                },
-            }
-        },
-        "/hidden_header": {
-            "get": {
-                "summary": "Hidden Header",
-                "operationId": "hidden_header_hidden_header_get",
-                "responses": {
-                    "200": {
-                        "description": "Successful Response",
-                        "content": {"application/json": {"schema": {}}},
-                    },
-                    "422": {
-                        "description": "Validation Error",
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/HTTPValidationError"
-                                }
-                            }
-                        },
-                    },
-                },
-            }
-        },
-        "/hidden_path/{hidden_path}": {
-            "get": {
-                "summary": "Hidden Path",
-                "operationId": "hidden_path_hidden_path__hidden_path__get",
-                "responses": {
-                    "200": {
-                        "description": "Successful Response",
-                        "content": {"application/json": {"schema": {}}},
-                    },
-                    "422": {
-                        "description": "Validation Error",
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/HTTPValidationError"
-                                }
-                            }
-                        },
-                    },
-                },
-            }
-        },
-        "/hidden_query": {
-            "get": {
-                "summary": "Hidden Query",
-                "operationId": "hidden_query_hidden_query_get",
-                "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"}]},
-                    },
-                    "msg": {"title": "Message", "type": "string"},
-                    "type": {"title": "Error Type", "type": "string"},
-                    "input": {"title": "Input"},
-                    "ctx": {"title": "Context", "type": "object"},
-                },
-            },
-        }
-    },
-}
-
-
-def test_openapi_schema():
-    client = TestClient(app)
-    response = client.get("/openapi.json")
-    assert response.status_code == 200
-    assert response.json() == openapi_schema
-
-
 @pytest.mark.parametrize(
     "path,cookies,expected_status,expected_response",
     [
@@ -242,3 +109,140 @@ def test_hidden_query(path, expected_status, expected_response):
     response = client.get(path)
     assert response.status_code == expected_status
     assert response.json() == expected_response
+
+
+def test_openapi_schema():
+    client = TestClient(app)
+    response = client.get("/openapi.json")
+    assert response.status_code == 200
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/hidden_cookie": {
+                    "get": {
+                        "summary": "Hidden Cookie",
+                        "operationId": "hidden_cookie_hidden_cookie_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
+                "/hidden_header": {
+                    "get": {
+                        "summary": "Hidden Header",
+                        "operationId": "hidden_header_hidden_header_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
+                "/hidden_path/{hidden_path}": {
+                    "get": {
+                        "summary": "Hidden Path",
+                        "operationId": "hidden_path_hidden_path__hidden_path__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
+                "/hidden_query": {
+                    "get": {
+                        "summary": "Hidden Query",
+                        "operationId": "hidden_query_hidden_query_get",
+                        "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"}]
+                                },
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
+                        },
+                    },
+                }
+            },
+        }
+    )
index 2b9299bc58a0f08042c52fc0b13dd462ac2b90b8..5759a3f9f6413d313cb42a463bcc40d8fdc5a1cd 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -27,72 +28,76 @@ def test_put_no_body_with_body():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Save Item No Body",
-                    "operationId": "save_item_no_body_items__item_id__put",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Save Item No Body",
+                        "operationId": "save_item_no_body_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6074b628285ee8108ddb6a26e7302e74ab36f27d..2069004f3c9417e65b16c0e01e643ec35c621253 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from fastapi import FastAPI, Query
 from fastapi.exceptions import FastAPIDeprecationWarning
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from .utils import needs_py310
 
@@ -64,79 +65,82 @@ def test_openapi_schema():
     client = get_client()
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    # insert_assert(response.json())
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "name": "q",
-                            "in": "query",
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {"type": "string", "pattern": "^fixedquery$"},
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "name": "q",
+                                "in": "query",
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {"type": "string", "pattern": "^fixedquery$"},
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 0fc7e3d3ef03c36896f90f145239b98bdcefc679..304052dd11889076df901c55e34af879b926051e 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import Depends, FastAPI, Header, status
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -19,86 +20,90 @@ def get_deps(dep1: str = Depends(get_header), dep2: str = Depends(get_something_
 
 client = TestClient(app)
 
-schema = {
-    "components": {
-        "schemas": {
-            "HTTPValidationError": {
-                "properties": {
-                    "detail": {
-                        "items": {"$ref": "#/components/schemas/ValidationError"},
-                        "title": "Detail",
-                        "type": "array",
-                    }
-                },
-                "title": "HTTPValidationError",
-                "type": "object",
-            },
-            "ValidationError": {
-                "properties": {
-                    "ctx": {"title": "Context", "type": "object"},
-                    "input": {"title": "Input"},
-                    "loc": {
-                        "items": {"anyOf": [{"type": "string"}, {"type": "integer"}]},
-                        "title": "Location",
-                        "type": "array",
-                    },
-                    "msg": {"title": "Message", "type": "string"},
-                    "type": {"title": "Error Type", "type": "string"},
-                },
-                "required": ["loc", "msg", "type"],
-                "title": "ValidationError",
-                "type": "object",
-            },
-        }
-    },
-    "info": {"title": "FastAPI", "version": "0.1.0"},
-    "openapi": "3.1.0",
-    "paths": {
-        "/": {
-            "get": {
-                "operationId": "get_deps__get",
-                "parameters": [
-                    {
-                        "in": "header",
-                        "name": "someheader",
-                        "required": True,
-                        "schema": {"title": "Someheader", "type": "string"},
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "content": {"application/json": {"schema": {}}},
-                        "description": "Successful Response",
-                    },
-                    "422": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/HTTPValidationError"
-                                }
-                            }
-                        },
-                        "description": "Validation Error",
-                    },
-                },
-                "summary": "Get Deps",
-            }
-        }
-    },
-}
+
+def test_response():
+    response = client.get("/", headers={"someheader": "hello"})
+    assert response.status_code == status.HTTP_200_OK
+    assert response.json() == {"dep1": "hello", "dep2": "hello123"}
 
 
-def test_schema():
+def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == status.HTTP_200_OK
     actual_schema = response.json()
-    assert actual_schema == schema
     assert (
         len(actual_schema["paths"]["/"]["get"]["parameters"]) == 1
     )  # primary goal of this test
-
-
-def test_response():
-    response = client.get("/", headers={"someheader": "hello"})
-    assert response.status_code == status.HTTP_200_OK
-    assert response.json() == {"dep1": "hello", "dep2": "hello123"}
+    assert actual_schema == snapshot(
+        {
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "title": "Detail",
+                                "type": "array",
+                            }
+                        },
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                        },
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
+                        "type": "object",
+                    },
+                }
+            },
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "openapi": "3.1.0",
+            "paths": {
+                "/": {
+                    "get": {
+                        "operationId": "get_deps__get",
+                        "parameters": [
+                            {
+                                "in": "header",
+                                "name": "someheader",
+                                "required": True,
+                                "schema": {"title": "Someheader", "type": "string"},
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                                "description": "Validation Error",
+                            },
+                        },
+                        "summary": "Get Deps",
+                    }
+                }
+            },
+        }
+    )
index 49e4ad4a2e6f8ede4f79ec0a039a68d6ef312515..32cd55ec31fbba331efd1ddbf865fa5019e7bfd9 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI, Path, Query, status
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -24,79 +25,82 @@ def test_get_parameters():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == status.HTTP_200_OK
-    actual_schema = response.json()
-    assert actual_schema == {
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "title": "Detail",
-                            "type": "array",
-                        }
+    assert response.json() == snapshot(
+        {
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "title": "Detail",
+                                "type": "array",
+                            }
+                        },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "title": "Location",
+                                "type": "array",
                             },
-                            "title": "Location",
-                            "type": "array",
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                    "type": "object",
-                },
-            }
-        },
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "openapi": "3.1.0",
-        "paths": {
-            "/{repeated_alias}": {
-                "get": {
-                    "operationId": "get_parameters_with_repeated_aliases__repeated_alias__get",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "repeated_alias",
-                            "required": True,
-                            "schema": {"title": "Repeated Alias", "type": "string"},
-                        },
-                        {
-                            "in": "query",
-                            "name": "repeated_alias",
-                            "required": True,
-                            "schema": {"title": "Repeated Alias", "type": "string"},
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "content": {"application/json": {"schema": {}}},
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                }
+            },
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "openapi": "3.1.0",
+            "paths": {
+                "/{repeated_alias}": {
+                    "get": {
+                        "operationId": "get_parameters_with_repeated_aliases__repeated_alias__get",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "repeated_alias",
+                                "required": True,
+                                "schema": {"title": "Repeated Alias", "type": "string"},
+                            },
+                            {
+                                "in": "query",
+                                "name": "repeated_alias",
+                                "required": True,
+                                "schema": {"title": "Repeated Alias", "type": "string"},
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
-                    "summary": "Get Parameters With Repeated Aliases",
+                        "summary": "Get Parameters With Repeated Aliases",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index b31aefa47968e953fe9d02d8f08d4a3ba29af83c..77da6aafcb1f2deebb70a22b657ffbcbfb01509b 100644 (file)
@@ -2,6 +2,7 @@ from typing import Any
 
 from fastapi import FastAPI, Response
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -31,69 +32,73 @@ def test_dependency_set_status_code():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/{id}": {
-                "delete": {
-                    "summary": "Delete Deployment",
-                    "operationId": "delete_deployment__id__delete",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Id", "type": "integer"},
-                            "name": "id",
-                            "in": "path",
-                        }
-                    ],
-                    "responses": {
-                        "204": {"description": "Successful Response"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/{id}": {
+                    "delete": {
+                        "summary": "Delete Deployment",
+                        "operationId": "delete_deployment__id__delete",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Id", "type": "integer"},
+                                "name": "id",
+                                "in": "path",
+                            }
+                        ],
+                        "responses": {
+                            "204": {"description": "Successful Response"},
+                            "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 8731c3e5d332d36abd8d835710be0461fb646dab..10e7be50cb9a1293bf94459ff3bfa57dcf8ff4b5 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import Body, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -37,141 +38,147 @@ client = TestClient(app)
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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"
+    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,
                         },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/shops": {
+                    "post": {
+                        "summary": "Create Shop",
+                        "operationId": "create_shop_shops_post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/vnd.api+json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$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"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
             },
-            "/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"
-                                }
-                            }
+            "components": {
+                "schemas": {
+                    "Body_create_product_products_post": {
+                        "title": "Body_create_product_products_post",
+                        "required": ["data"],
+                        "type": "object",
+                        "properties": {
+                            "data": {"$ref": "#/components/schemas/Product"}
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
+                    "Body_create_shop_shops_post": {
+                        "title": "Body_create_shop_shops_post",
+                        "required": ["data"],
+                        "type": "object",
+                        "properties": {
+                            "data": {"$ref": "#/components/schemas/Shop"},
+                            "included": {
+                                "title": "Included",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Product"},
+                                "default": [],
                             },
                         },
                     },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_create_product_products_post": {
-                    "title": "Body_create_product_products_post",
-                    "required": ["data"],
-                    "type": "object",
-                    "properties": {"data": {"$ref": "#/components/schemas/Product"}},
-                },
-                "Body_create_shop_shops_post": {
-                    "title": "Body_create_shop_shops_post",
-                    "required": ["data"],
-                    "type": "object",
-                    "properties": {
-                        "data": {"$ref": "#/components/schemas/Shop"},
-                        "included": {
-                            "title": "Included",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Product"},
-                            "default": [],
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
                         },
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "Product": {
+                        "title": "Product",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
                     },
-                },
-                "Product": {
-                    "title": "Product",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
+                    "Shop": {
+                        "title": "Shop",
+                        "required": ["name"],
+                        "type": "object",
+                        "properties": {"name": {"title": "Name", "type": "string"}},
                     },
-                },
-                "Shop": {
-                    "title": "Shop",
-                    "required": ["name"],
-                    "type": "object",
-                    "properties": {"name": {"title": "Name", "type": "string"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6f381c8b8668be83cd606324925a85565a9e57cb..1b2a18b072ca8d4e03d65ea68dab19379964f397 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated, Optional
 import pytest
 from fastapi import Cookie, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -30,17 +31,19 @@ async def read_model_optional_str(p: Annotated[CookieModelOptionalStr, Cookie()]
     ["/optional-str", "/model-optional-str"],
 )
 def test_optional_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P",
-            },
-            "name": "p",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P",
+                },
+                "name": "p",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -91,17 +94,19 @@ async def read_model_optional_alias(p: Annotated[CookieModelOptionalAlias, Cooki
     ["/optional-alias", "/model-optional-alias"],
 )
 def test_optional_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Alias",
-            },
-            "name": "p_alias",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Alias",
+                },
+                "name": "p_alias",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -169,17 +174,19 @@ def read_model_optional_validation_alias(
     ["/optional-validation-alias", "/model-optional-validation-alias"],
 )
 def test_optional_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -255,17 +262,19 @@ def read_model_optional_alias_and_validation_alias(
     ],
 )
 def test_optional_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 3e877b3e3de6e36a9348997989b6e7fffedc0215..25f93bba667838719c6224dd7db120dcca4f3f48 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from dirty_equals import IsOneOf
 from fastapi import Cookie, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -31,14 +32,16 @@ async def read_model_required_str(p: Annotated[CookieModelRequiredStr, Cookie()]
     ["/required-str", "/model-required-str"],
 )
 def test_required_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P", "type": "string"},
-            "name": "p",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P", "type": "string"},
+                "name": "p",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -96,14 +99,16 @@ async def read_model_required_alias(p: Annotated[CookieModelRequiredAlias, Cooki
     ["/required-alias", "/model-required-alias"],
 )
 def test_required_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Alias", "type": "string"},
-            "name": "p_alias",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Alias", "type": "string"},
+                "name": "p_alias",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -195,14 +200,16 @@ def read_model_required_validation_alias(
     ["/required-validation-alias", "/model-required-validation-alias"],
 )
 def test_required_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Val Alias", "type": "string"},
-            "name": "p_val_alias",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Val Alias", "type": "string"},
+                "name": "p_val_alias",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -302,14 +309,16 @@ def read_model_required_alias_and_validation_alias(
     ],
 )
 def test_required_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Val Alias", "type": "string"},
-            "name": "p_val_alias",
-            "in": "cookie",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Val Alias", "type": "string"},
+                "name": "p_val_alias",
+                "in": "cookie",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 489a6b3e7d70ab11083a9a6cab309d2bd6e71261..4b8e2adb4a0d8c7d12996d3f822064951ca50f24 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from dirty_equals import AnyThing, IsOneOf, IsPartialDict
 from fastapi import FastAPI, Header
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -31,18 +32,20 @@ def read_model_required_list_str(p: Annotated[HeaderModelRequiredListStr, Header
     ["/required-list-str", "/model-required-list-str"],
 )
 def test_required_list_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -101,18 +104,20 @@ async def read_model_required_list_alias(
     ["/required-list-alias", "/model-required-list-alias"],
 )
 def test_required_list_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P Alias",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P Alias",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -199,18 +204,20 @@ async def read_model_required_list_validation_alias(
     ["/required-list-validation-alias", "/model-required-list-validation-alias"],
 )
 def test_required_list_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P Val Alias",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P Val Alias",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -307,18 +314,20 @@ def read_model_required_list_alias_and_validation_alias(
     ],
 )
 def test_required_list_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P Val Alias",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P Val Alias",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 5dd4ea9ade19ef2d6929972c5a70f228c4e82c85..3bbb73d5442459fccd5f590bd6c0e0c5af1428e0 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated, Optional
 import pytest
 from fastapi import FastAPI, Header
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -34,20 +35,22 @@ async def read_model_optional_list_str(
     ["/optional-list-str", "/model-optional-list-str"],
 )
 def test_optional_list_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P",
-            },
-            "name": "p",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P",
+                },
+                "name": "p",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -99,20 +102,22 @@ async def read_model_optional_list_alias(
     ["/optional-list-alias", "/model-optional-list-alias"],
 )
 def test_optional_list_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P Alias",
-            },
-            "name": "p_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P Alias",
+                },
+                "name": "p_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -178,20 +183,22 @@ def read_model_optional_list_validation_alias(
     ["/optional-list-validation-alias", "/model-optional-list-validation-alias"],
 )
 def test_optional_list_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -266,20 +273,22 @@ def read_model_optional_list_alias_and_validation_alias(
     ],
 )
 def test_optional_list_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 0bd0eddc1b1089bb2f44ade460e268bfdf07be9d..a5174e59af24ea9979093a1205b11aae0bb9527b 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated, Optional
 import pytest
 from fastapi import FastAPI, Header
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -30,17 +31,19 @@ async def read_model_optional_str(p: Annotated[HeaderModelOptionalStr, Header()]
     ["/optional-str", "/model-optional-str"],
 )
 def test_optional_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P",
-            },
-            "name": "p",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P",
+                },
+                "name": "p",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -90,17 +93,19 @@ async def read_model_optional_alias(p: Annotated[HeaderModelOptionalAlias, Heade
     ["/optional-alias", "/model-optional-alias"],
 )
 def test_optional_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Alias",
-            },
-            "name": "p_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Alias",
+                },
+                "name": "p_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -166,17 +171,19 @@ def read_model_optional_validation_alias(
     ["/optional-validation-alias", "/model-optional-validation-alias"],
 )
 def test_optional_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -250,17 +257,19 @@ def read_model_optional_alias_and_validation_alias(
     ],
 )
 def test_optional_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 20dd296570eede53e159dde17220a1c589dd916f..2df9b5f2ffd7920b1afd965fa80c3f9bc87e261c 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from dirty_equals import AnyThing, IsOneOf, IsPartialDict
 from fastapi import FastAPI, Header
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -31,14 +32,16 @@ async def read_model_required_str(p: Annotated[HeaderModelRequiredStr, Header()]
     ["/required-str", "/model-required-str"],
 )
 def test_required_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P", "type": "string"},
-            "name": "p",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P", "type": "string"},
+                "name": "p",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -95,14 +98,16 @@ async def read_model_required_alias(p: Annotated[HeaderModelRequiredAlias, Heade
     ["/required-alias", "/model-required-alias"],
 )
 def test_required_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Alias", "type": "string"},
-            "name": "p_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Alias", "type": "string"},
+                "name": "p_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -189,14 +194,16 @@ def read_model_required_validation_alias(
     ["/required-validation-alias", "/model-required-validation-alias"],
 )
 def test_required_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Val Alias", "type": "string"},
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Val Alias", "type": "string"},
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -294,14 +301,16 @@ def read_model_required_alias_and_validation_alias(
     ],
 )
 def test_required_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Val Alias", "type": "string"},
-            "name": "p_val_alias",
-            "in": "header",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Val Alias", "type": "string"},
+                "name": "p_val_alias",
+                "in": "header",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index b2d63667e29f33086d56764c903fd92ca367882d..5add058c2b3130ae15b475d2d689ef68856f9be4 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated
 import pytest
 from fastapi import FastAPI, Path
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -53,14 +54,16 @@ def read_required_alias_and_validation_alias(
     ],
 )
 def test_schema(path: str, expected_name: str, expected_title: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": expected_title, "type": "string"},
-            "name": expected_name,
-            "in": "path",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": expected_title, "type": "string"},
+                "name": expected_name,
+                "in": "path",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index e933da214d1980c054777ea7eaa5c3c46858480d..a5cd0302185e017b373f6560ef491133fb0139e2 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from dirty_equals import IsOneOf
 from fastapi import FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -31,18 +32,20 @@ def read_model_required_list_str(p: Annotated[QueryModelRequiredListStr, Query()
     ["/required-list-str", "/model-required-list-str"],
 )
 def test_required_list_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -101,18 +104,20 @@ async def read_model_required_list_alias(
     ["/required-list-alias", "/model-required-list-alias"],
 )
 def test_required_list_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P Alias",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P Alias",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -199,18 +204,20 @@ async def read_model_required_list_validation_alias(
     ["/required-list-validation-alias", "/model-required-list-validation-alias"],
 )
 def test_required_list_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P Val Alias",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P Val Alias",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -305,18 +312,20 @@ def read_model_required_list_alias_and_validation_alias(
     ],
 )
 def test_required_list_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {
-                "title": "P Val Alias",
-                "type": "array",
-                "items": {"type": "string"},
-            },
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {
+                    "title": "P Val Alias",
+                    "type": "array",
+                    "items": {"type": "string"},
+                },
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 351e03a7138dd4723ea4a8bd0d15dbd332004717..5608c6499b8ee88ba2fd152fd07c497f8585c2ee 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated, Optional
 import pytest
 from fastapi import FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -34,20 +35,22 @@ async def read_model_optional_list_str(
     ["/optional-list-str", "/model-optional-list-str"],
 )
 def test_optional_list_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P",
-            },
-            "name": "p",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P",
+                },
+                "name": "p",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -99,20 +102,22 @@ async def read_model_optional_list_alias(
     ["/optional-list-alias", "/model-optional-list-alias"],
 )
 def test_optional_list_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P Alias",
-            },
-            "name": "p_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P Alias",
+                },
+                "name": "p_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -178,20 +183,22 @@ def read_model_optional_list_validation_alias(
     ["/optional-list-validation-alias", "/model-optional-list-validation-alias"],
 )
 def test_optional_list_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -264,20 +271,22 @@ def read_model_optional_list_alias_and_validation_alias(
     ],
 )
 def test_optional_list_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [
-                    {"items": {"type": "string"}, "type": "array"},
-                    {"type": "null"},
-                ],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [
+                        {"items": {"type": "string"}, "type": "array"},
+                        {"type": "null"},
+                    ],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 12e1b465a76cde68818dc68331edaec863ed7a8b..b181686b05f7b396d7dc933fae133abd926b4cff 100644 (file)
@@ -3,6 +3,7 @@ from typing import Annotated, Optional
 import pytest
 from fastapi import FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -30,17 +31,19 @@ async def read_model_optional_str(p: Annotated[QueryModelOptionalStr, Query()]):
     ["/optional-str", "/model-optional-str"],
 )
 def test_optional_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P",
-            },
-            "name": "p",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P",
+                },
+                "name": "p",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -90,17 +93,19 @@ async def read_model_optional_alias(p: Annotated[QueryModelOptionalAlias, Query(
     ["/optional-alias", "/model-optional-alias"],
 )
 def test_optional_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Alias",
-            },
-            "name": "p_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Alias",
+                },
+                "name": "p_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -166,17 +171,19 @@ def read_model_optional_validation_alias(
     ["/optional-validation-alias", "/model-optional-validation-alias"],
 )
 def test_optional_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -250,17 +257,19 @@ def read_model_optional_alias_and_validation_alias(
     ],
 )
 def test_optional_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": False,
-            "schema": {
-                "anyOf": [{"type": "string"}, {"type": "null"}],
-                "title": "P Val Alias",
-            },
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": False,
+                "schema": {
+                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "title": "P Val Alias",
+                },
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 9e7b961453e1abc678a2a12770323a6b41c8e3fe..c60e5ca02a5c24a513dd7e902c3bf48583f64818 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from dirty_equals import IsOneOf
 from fastapi import FastAPI, Query
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, Field
 
 app = FastAPI()
@@ -31,14 +32,16 @@ async def read_model_required_str(p: Annotated[QueryModelRequiredStr, Query()]):
     ["/required-str", "/model-required-str"],
 )
 def test_required_str_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P", "type": "string"},
-            "name": "p",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P", "type": "string"},
+                "name": "p",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -95,14 +98,16 @@ async def read_model_required_alias(p: Annotated[QueryModelRequiredAlias, Query(
     ["/required-alias", "/model-required-alias"],
 )
 def test_required_str_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Alias", "type": "string"},
-            "name": "p_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Alias", "type": "string"},
+                "name": "p_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -192,14 +197,16 @@ def read_model_required_validation_alias(
     ["/required-validation-alias", "/model-required-validation-alias"],
 )
 def test_required_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Val Alias", "type": "string"},
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Val Alias", "type": "string"},
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
@@ -297,14 +304,16 @@ def read_model_required_alias_and_validation_alias(
     ],
 )
 def test_required_alias_and_validation_alias_schema(path: str):
-    assert app.openapi()["paths"][path]["get"]["parameters"] == [
-        {
-            "required": True,
-            "schema": {"title": "P Val Alias", "type": "string"},
-            "name": "p_val_alias",
-            "in": "query",
-        }
-    ]
+    assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
+        [
+            {
+                "required": True,
+                "schema": {"title": "P Val Alias", "type": "string"},
+                "name": "p_val_alias",
+                "in": "query",
+            }
+        ]
+    )
 
 
 @pytest.mark.parametrize(
index 807d2600b99e8406427eacf124910f4dc661c960..cf97934a9b9f5aecc84855f7c92a10a6d34a2557 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, ConfigDict, Field
 
 app = FastAPI()
@@ -136,188 +137,194 @@ def test_read_list_no_alias():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/dict": {
-                "get": {
-                    "summary": "Read Dict",
-                    "operationId": "read_dict_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Model"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/model": {
-                "get": {
-                    "summary": "Read Model",
-                    "operationId": "read_model_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Model"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/list": {
-                "get": {
-                    "summary": "Read List",
-                    "operationId": "read_list_list_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Read List List Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Model"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/dict": {
+                    "get": {
+                        "summary": "Read Dict",
+                        "operationId": "read_dict_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Model"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/by-alias/dict": {
-                "get": {
-                    "summary": "By Alias Dict",
-                    "operationId": "by_alias_dict_by_alias_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Model"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/by-alias/model": {
-                "get": {
-                    "summary": "By Alias Model",
-                    "operationId": "by_alias_model_by_alias_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Model"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/by-alias/list": {
-                "get": {
-                    "summary": "By Alias List",
-                    "operationId": "by_alias_list_by_alias_list_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response By Alias List By Alias List Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Model"},
+                                },
+                            }
+                        },
+                    }
+                },
+                "/model": {
+                    "get": {
+                        "summary": "Read Model",
+                        "operationId": "read_model_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Model"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no-alias/dict": {
-                "get": {
-                    "summary": "No Alias Dict",
-                    "operationId": "no_alias_dict_no_alias_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ModelNoAlias"
+                                },
+                            }
+                        },
+                    }
+                },
+                "/list": {
+                    "get": {
+                        "summary": "Read List",
+                        "operationId": "read_list_list_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Read List List Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Model"
+                                            },
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no-alias/model": {
-                "get": {
-                    "summary": "No Alias Model",
-                    "operationId": "no_alias_model_no_alias_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ModelNoAlias"
+                                },
+                            }
+                        },
+                    }
+                },
+                "/by-alias/dict": {
+                    "get": {
+                        "summary": "By Alias Dict",
+                        "operationId": "by_alias_dict_by_alias_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Model"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no-alias/list": {
-                "get": {
-                    "summary": "No Alias List",
-                    "operationId": "no_alias_list_no_alias_list_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response No Alias List No Alias List Get",
-                                        "type": "array",
-                                        "items": {
+                                },
+                            }
+                        },
+                    }
+                },
+                "/by-alias/model": {
+                    "get": {
+                        "summary": "By Alias Model",
+                        "operationId": "by_alias_model_by_alias_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Model"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/by-alias/list": {
+                    "get": {
+                        "summary": "By Alias List",
+                        "operationId": "by_alias_list_by_alias_list_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response By Alias List By Alias List Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Model"
+                                            },
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no-alias/dict": {
+                    "get": {
+                        "summary": "No Alias Dict",
+                        "operationId": "no_alias_dict_no_alias_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ModelNoAlias"
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no-alias/model": {
+                    "get": {
+                        "summary": "No Alias Model",
+                        "operationId": "no_alias_model_no_alias_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
                                             "$ref": "#/components/schemas/ModelNoAlias"
-                                        },
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no-alias/list": {
+                    "get": {
+                        "summary": "No Alias List",
+                        "operationId": "no_alias_list_no_alias_list_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response No Alias List No Alias List Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/ModelNoAlias"
+                                            },
+                                        }
                                     }
-                                }
-                            },
-                        }
+                                },
+                            }
+                        },
+                    }
+                },
+            },
+            "components": {
+                "schemas": {
+                    "Model": {
+                        "title": "Model",
+                        "required": ["alias"],
+                        "type": "object",
+                        "properties": {"alias": {"title": "Alias", "type": "string"}},
+                    },
+                    "ModelNoAlias": {
+                        "title": "ModelNoAlias",
+                        "required": ["name"],
+                        "type": "object",
+                        "properties": {"name": {"title": "Name", "type": "string"}},
+                        "description": "response_model_by_alias=False is basically a quick hack, to support proper OpenAPI use another model with the correct field names",
                     },
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "Model": {
-                    "title": "Model",
-                    "required": ["alias"],
-                    "type": "object",
-                    "properties": {"alias": {"title": "Alias", "type": "string"}},
-                },
-                "ModelNoAlias": {
-                    "title": "ModelNoAlias",
-                    "required": ["name"],
-                    "type": "object",
-                    "properties": {"name": {"title": "Name", "type": "string"}},
-                    "description": "response_model_by_alias=False is basically a quick hack, to support proper OpenAPI use another model with the correct field names",
-                },
-            }
-        },
-    }
+        }
+    )
index 4dc164bf92120c2e5ae06ea3587681b0ea77b9e0..75582cd607fb25bb86ea29fa96bdd0782db0eb0a 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Response
 from fastapi.responses import JSONResponse
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -39,73 +40,75 @@ client = TestClient(app)
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a": {
-                "get": {
-                    "responses": {
-                        "500": {
-                            "description": "Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/JsonApiError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a": {
+                    "get": {
+                        "responses": {
+                            "500": {
+                                "description": "Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/JsonApiError"
+                                        }
                                     }
-                                }
+                                },
                             },
+                            "200": {"description": "Successful Response"},
                         },
-                        "200": {"description": "Successful Response"},
-                    },
-                    "summary": "A",
-                    "operationId": "a_a_get",
-                }
-            },
-            "/b": {
-                "get": {
-                    "responses": {
-                        "500": {
-                            "description": "Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Error"}
-                                }
+                        "summary": "A",
+                        "operationId": "a_a_get",
+                    }
+                },
+                "/b": {
+                    "get": {
+                        "responses": {
+                            "500": {
+                                "description": "Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Error"}
+                                    }
+                                },
+                            },
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
                         },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "summary": "B",
+                        "operationId": "b_b_get",
+                    }
+                },
+            },
+            "components": {
+                "schemas": {
+                    "Error": {
+                        "title": "Error",
+                        "required": ["status", "title"],
+                        "type": "object",
+                        "properties": {
+                            "status": {"title": "Status", "type": "string"},
+                            "title": {"title": "Title", "type": "string"},
+                        },
+                    },
+                    "JsonApiError": {
+                        "title": "JsonApiError",
+                        "required": ["errors"],
+                        "type": "object",
+                        "properties": {
+                            "errors": {
+                                "title": "Errors",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Error"},
+                            }
                         },
                     },
-                    "summary": "B",
-                    "operationId": "b_b_get",
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "Error": {
-                    "title": "Error",
-                    "required": ["status", "title"],
-                    "type": "object",
-                    "properties": {
-                        "status": {"title": "Status", "type": "string"},
-                        "title": {"title": "Title", "type": "string"},
-                    },
-                },
-                "JsonApiError": {
-                    "title": "JsonApiError",
-                    "required": ["errors"],
-                    "type": "object",
-                    "properties": {
-                        "errors": {
-                            "title": "Errors",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Error"},
-                        }
-                    },
-                },
-            }
-        },
-    }
+        }
+    )
index 70456a7462c7fcc22da90a8ddd82ba196379f309..21562106506d5716f1d4e7c341eb089fbe56d3cb 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI
 from fastapi.responses import JSONResponse
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -47,66 +48,68 @@ def test_get_response():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/a": {
-                "get": {
-                    "responses": {
-                        "500": {
-                            "description": "Error",
-                            "content": {
-                                "application/vnd.api+json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/JsonApiError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/a": {
+                    "get": {
+                        "responses": {
+                            "500": {
+                                "description": "Error",
+                                "content": {
+                                    "application/vnd.api+json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/JsonApiError"
+                                        }
                                     }
-                                }
+                                },
                             },
+                            "204": {"description": "Successful Response"},
                         },
-                        "204": {"description": "Successful Response"},
-                    },
-                    "summary": "A",
-                    "operationId": "a_a_get",
-                }
+                        "summary": "A",
+                        "operationId": "a_a_get",
+                    }
+                },
+                "/b": {
+                    "get": {
+                        "responses": {
+                            "204": {"description": "No Content"},
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                        },
+                        "summary": "B",
+                        "operationId": "b_b_get",
+                    }
+                },
             },
-            "/b": {
-                "get": {
-                    "responses": {
-                        "204": {"description": "No Content"},
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+            "components": {
+                "schemas": {
+                    "Error": {
+                        "title": "Error",
+                        "required": ["status", "title"],
+                        "type": "object",
+                        "properties": {
+                            "status": {"title": "Status", "type": "string"},
+                            "title": {"title": "Title", "type": "string"},
+                        },
+                    },
+                    "JsonApiError": {
+                        "title": "JsonApiError",
+                        "required": ["errors"],
+                        "type": "object",
+                        "properties": {
+                            "errors": {
+                                "title": "Errors",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Error"},
+                            }
                         },
                     },
-                    "summary": "B",
-                    "operationId": "b_b_get",
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "Error": {
-                    "title": "Error",
-                    "required": ["status", "title"],
-                    "type": "object",
-                    "properties": {
-                        "status": {"title": "Status", "type": "string"},
-                        "title": {"title": "Title", "type": "string"},
-                    },
-                },
-                "JsonApiError": {
-                    "title": "JsonApiError",
-                    "required": ["errors"],
-                    "type": "object",
-                    "properties": {
-                        "errors": {
-                            "title": "Errors",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Error"},
-                        }
-                    },
-                },
-            }
-        },
-    }
+        }
+    )
index 58fba89f1ab1723c70f432cc6497f645180a1dcd..ded5971027750d1329f7e8dd6e4ee8743df7fa96 100644 (file)
@@ -5,6 +5,7 @@ from fastapi import FastAPI
 from fastapi.exceptions import FastAPIError, ResponseValidationError
 from fastapi.responses import JSONResponse, Response
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 
@@ -512,603 +513,611 @@ def test_invalid_response_model_field():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/no_response_model-no_annotation-return_model": {
-                "get": {
-                    "summary": "No Response Model No Annotation Return Model",
-                    "operationId": "no_response_model_no_annotation_return_model_no_response_model_no_annotation_return_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/no_response_model-no_annotation-return_dict": {
-                "get": {
-                    "summary": "No Response Model No Annotation Return Dict",
-                    "operationId": "no_response_model_no_annotation_return_dict_no_response_model_no_annotation_return_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model-no_annotation-return_same_model": {
-                "get": {
-                    "summary": "Response Model No Annotation Return Same Model",
-                    "operationId": "response_model_no_annotation_return_same_model_response_model_no_annotation_return_same_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model-no_annotation-return_exact_dict": {
-                "get": {
-                    "summary": "Response Model No Annotation Return Exact Dict",
-                    "operationId": "response_model_no_annotation_return_exact_dict_response_model_no_annotation_return_exact_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model-no_annotation-return_invalid_dict": {
-                "get": {
-                    "summary": "Response Model No Annotation Return Invalid Dict",
-                    "operationId": "response_model_no_annotation_return_invalid_dict_response_model_no_annotation_return_invalid_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model-no_annotation-return_invalid_model": {
-                "get": {
-                    "summary": "Response Model No Annotation Return Invalid Model",
-                    "operationId": "response_model_no_annotation_return_invalid_model_response_model_no_annotation_return_invalid_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model-no_annotation-return_dict_with_extra_data": {
-                "get": {
-                    "summary": "Response Model No Annotation Return Dict With Extra Data",
-                    "operationId": "response_model_no_annotation_return_dict_with_extra_data_response_model_no_annotation_return_dict_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model-no_annotation-return_submodel_with_extra_data": {
-                "get": {
-                    "summary": "Response Model No Annotation Return Submodel With Extra Data",
-                    "operationId": "response_model_no_annotation_return_submodel_with_extra_data_response_model_no_annotation_return_submodel_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation-return_same_model": {
-                "get": {
-                    "summary": "No Response Model Annotation Return Same Model",
-                    "operationId": "no_response_model_annotation_return_same_model_no_response_model_annotation_return_same_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation-return_exact_dict": {
-                "get": {
-                    "summary": "No Response Model Annotation Return Exact Dict",
-                    "operationId": "no_response_model_annotation_return_exact_dict_no_response_model_annotation_return_exact_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation-return_invalid_dict": {
-                "get": {
-                    "summary": "No Response Model Annotation Return Invalid Dict",
-                    "operationId": "no_response_model_annotation_return_invalid_dict_no_response_model_annotation_return_invalid_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation-return_invalid_model": {
-                "get": {
-                    "summary": "No Response Model Annotation Return Invalid Model",
-                    "operationId": "no_response_model_annotation_return_invalid_model_no_response_model_annotation_return_invalid_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation-return_dict_with_extra_data": {
-                "get": {
-                    "summary": "No Response Model Annotation Return Dict With Extra Data",
-                    "operationId": "no_response_model_annotation_return_dict_with_extra_data_no_response_model_annotation_return_dict_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation-return_submodel_with_extra_data": {
-                "get": {
-                    "summary": "No Response Model Annotation Return Submodel With Extra Data",
-                    "operationId": "no_response_model_annotation_return_submodel_with_extra_data_no_response_model_annotation_return_submodel_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_none-annotation-return_same_model": {
-                "get": {
-                    "summary": "Response Model None Annotation Return Same Model",
-                    "operationId": "response_model_none_annotation_return_same_model_response_model_none_annotation_return_same_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model_none-annotation-return_exact_dict": {
-                "get": {
-                    "summary": "Response Model None Annotation Return Exact Dict",
-                    "operationId": "response_model_none_annotation_return_exact_dict_response_model_none_annotation_return_exact_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model_none-annotation-return_invalid_dict": {
-                "get": {
-                    "summary": "Response Model None Annotation Return Invalid Dict",
-                    "operationId": "response_model_none_annotation_return_invalid_dict_response_model_none_annotation_return_invalid_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model_none-annotation-return_invalid_model": {
-                "get": {
-                    "summary": "Response Model None Annotation Return Invalid Model",
-                    "operationId": "response_model_none_annotation_return_invalid_model_response_model_none_annotation_return_invalid_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model_none-annotation-return_dict_with_extra_data": {
-                "get": {
-                    "summary": "Response Model None Annotation Return Dict With Extra Data",
-                    "operationId": "response_model_none_annotation_return_dict_with_extra_data_response_model_none_annotation_return_dict_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model_none-annotation-return_submodel_with_extra_data": {
-                "get": {
-                    "summary": "Response Model None Annotation Return Submodel With Extra Data",
-                    "operationId": "response_model_none_annotation_return_submodel_with_extra_data_response_model_none_annotation_return_submodel_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-            "/response_model_model1-annotation_model2-return_same_model": {
-                "get": {
-                    "summary": "Response Model Model1 Annotation Model2 Return Same Model",
-                    "operationId": "response_model_model1_annotation_model2_return_same_model_response_model_model1_annotation_model2_return_same_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_model1-annotation_model2-return_exact_dict": {
-                "get": {
-                    "summary": "Response Model Model1 Annotation Model2 Return Exact Dict",
-                    "operationId": "response_model_model1_annotation_model2_return_exact_dict_response_model_model1_annotation_model2_return_exact_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_model1-annotation_model2-return_invalid_dict": {
-                "get": {
-                    "summary": "Response Model Model1 Annotation Model2 Return Invalid Dict",
-                    "operationId": "response_model_model1_annotation_model2_return_invalid_dict_response_model_model1_annotation_model2_return_invalid_dict_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_model1-annotation_model2-return_invalid_model": {
-                "get": {
-                    "summary": "Response Model Model1 Annotation Model2 Return Invalid Model",
-                    "operationId": "response_model_model1_annotation_model2_return_invalid_model_response_model_model1_annotation_model2_return_invalid_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_model1-annotation_model2-return_dict_with_extra_data": {
-                "get": {
-                    "summary": "Response Model Model1 Annotation Model2 Return Dict With Extra Data",
-                    "operationId": "response_model_model1_annotation_model2_return_dict_with_extra_data_response_model_model1_annotation_model2_return_dict_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_model1-annotation_model2-return_submodel_with_extra_data": {
-                "get": {
-                    "summary": "Response Model Model1 Annotation Model2 Return Submodel With Extra Data",
-                    "operationId": "response_model_model1_annotation_model2_return_submodel_with_extra_data_response_model_model1_annotation_model2_return_submodel_with_extra_data_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_filtering_model-annotation_submodel-return_submodel": {
-                "get": {
-                    "summary": "Response Model Filtering Model Annotation Submodel Return Submodel",
-                    "operationId": "response_model_filtering_model_annotation_submodel_return_submodel_response_model_filtering_model_annotation_submodel_return_submodel_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_list_of_model-no_annotation": {
-                "get": {
-                    "summary": "Response Model List Of Model No Annotation",
-                    "operationId": "response_model_list_of_model_no_annotation_response_model_list_of_model_no_annotation_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Response Model List Of Model No Annotation Response Model List Of Model No Annotation Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/User"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/no_response_model-no_annotation-return_model": {
+                    "get": {
+                        "summary": "No Response Model No Annotation Return Model",
+                        "operationId": "no_response_model_no_annotation_return_model_no_response_model_no_annotation_return_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-no_annotation-return_dict": {
+                    "get": {
+                        "summary": "No Response Model No Annotation Return Dict",
+                        "operationId": "no_response_model_no_annotation_return_dict_no_response_model_no_annotation_return_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model-no_annotation-return_same_model": {
+                    "get": {
+                        "summary": "Response Model No Annotation Return Same Model",
+                        "operationId": "response_model_no_annotation_return_same_model_response_model_no_annotation_return_same_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation_list_of_model": {
-                "get": {
-                    "summary": "No Response Model Annotation List Of Model",
-                    "operationId": "no_response_model_annotation_list_of_model_no_response_model_annotation_list_of_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response No Response Model Annotation List Of Model No Response Model Annotation List Of Model Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/User"},
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model-no_annotation-return_exact_dict": {
+                    "get": {
+                        "summary": "Response Model No Annotation Return Exact Dict",
+                        "operationId": "response_model_no_annotation_return_exact_dict_response_model_no_annotation_return_exact_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation_forward_ref_list_of_model": {
-                "get": {
-                    "summary": "No Response Model Annotation Forward Ref List Of Model",
-                    "operationId": "no_response_model_annotation_forward_ref_list_of_model_no_response_model_annotation_forward_ref_list_of_model_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response No Response Model Annotation Forward Ref List Of Model No Response Model Annotation Forward Ref List Of Model Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/User"},
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model-no_annotation-return_invalid_dict": {
+                    "get": {
+                        "summary": "Response Model No Annotation Return Invalid Dict",
+                        "operationId": "response_model_no_annotation_return_invalid_dict_response_model_no_annotation_return_invalid_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_union-no_annotation-return_model1": {
-                "get": {
-                    "summary": "Response Model Union No Annotation Return Model1",
-                    "operationId": "response_model_union_no_annotation_return_model1_response_model_union_no_annotation_return_model1_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Response Model Union No Annotation Return Model1 Response Model Union No Annotation Return Model1 Get",
-                                        "anyOf": [
-                                            {"$ref": "#/components/schemas/User"},
-                                            {"$ref": "#/components/schemas/Item"},
-                                        ],
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model-no_annotation-return_invalid_model": {
+                    "get": {
+                        "summary": "Response Model No Annotation Return Invalid Model",
+                        "operationId": "response_model_no_annotation_return_invalid_model_response_model_no_annotation_return_invalid_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/response_model_union-no_annotation-return_model2": {
-                "get": {
-                    "summary": "Response Model Union No Annotation Return Model2",
-                    "operationId": "response_model_union_no_annotation_return_model2_response_model_union_no_annotation_return_model2_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Response Model Union No Annotation Return Model2 Response Model Union No Annotation Return Model2 Get",
-                                        "anyOf": [
-                                            {"$ref": "#/components/schemas/User"},
-                                            {"$ref": "#/components/schemas/Item"},
-                                        ],
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model-no_annotation-return_dict_with_extra_data": {
+                    "get": {
+                        "summary": "Response Model No Annotation Return Dict With Extra Data",
+                        "operationId": "response_model_no_annotation_return_dict_with_extra_data_response_model_no_annotation_return_dict_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation_union-return_model1": {
-                "get": {
-                    "summary": "No Response Model Annotation Union Return Model1",
-                    "operationId": "no_response_model_annotation_union_return_model1_no_response_model_annotation_union_return_model1_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response No Response Model Annotation Union Return Model1 No Response Model Annotation Union Return Model1 Get",
-                                        "anyOf": [
-                                            {"$ref": "#/components/schemas/User"},
-                                            {"$ref": "#/components/schemas/Item"},
-                                        ],
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model-no_annotation-return_submodel_with_extra_data": {
+                    "get": {
+                        "summary": "Response Model No Annotation Return Submodel With Extra Data",
+                        "operationId": "response_model_no_annotation_return_submodel_with_extra_data_response_model_no_annotation_return_submodel_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
-            },
-            "/no_response_model-annotation_union-return_model2": {
-                "get": {
-                    "summary": "No Response Model Annotation Union Return Model2",
-                    "operationId": "no_response_model_annotation_union_return_model2_no_response_model_annotation_union_return_model2_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response No Response Model Annotation Union Return Model2 No Response Model Annotation Union Return Model2 Get",
-                                        "anyOf": [
-                                            {"$ref": "#/components/schemas/User"},
-                                            {"$ref": "#/components/schemas/Item"},
-                                        ],
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation-return_same_model": {
+                    "get": {
+                        "summary": "No Response Model Annotation Return Same Model",
+                        "operationId": "no_response_model_annotation_return_same_model_no_response_model_annotation_return_same_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
                                     }
-                                }
-                            },
-                        }
-                    },
-                }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation-return_exact_dict": {
+                    "get": {
+                        "summary": "No Response Model Annotation Return Exact Dict",
+                        "operationId": "no_response_model_annotation_return_exact_dict_no_response_model_annotation_return_exact_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation-return_invalid_dict": {
+                    "get": {
+                        "summary": "No Response Model Annotation Return Invalid Dict",
+                        "operationId": "no_response_model_annotation_return_invalid_dict_no_response_model_annotation_return_invalid_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation-return_invalid_model": {
+                    "get": {
+                        "summary": "No Response Model Annotation Return Invalid Model",
+                        "operationId": "no_response_model_annotation_return_invalid_model_no_response_model_annotation_return_invalid_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation-return_dict_with_extra_data": {
+                    "get": {
+                        "summary": "No Response Model Annotation Return Dict With Extra Data",
+                        "operationId": "no_response_model_annotation_return_dict_with_extra_data_no_response_model_annotation_return_dict_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation-return_submodel_with_extra_data": {
+                    "get": {
+                        "summary": "No Response Model Annotation Return Submodel With Extra Data",
+                        "operationId": "no_response_model_annotation_return_submodel_with_extra_data_no_response_model_annotation_return_submodel_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_none-annotation-return_same_model": {
+                    "get": {
+                        "summary": "Response Model None Annotation Return Same Model",
+                        "operationId": "response_model_none_annotation_return_same_model_response_model_none_annotation_return_same_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model_none-annotation-return_exact_dict": {
+                    "get": {
+                        "summary": "Response Model None Annotation Return Exact Dict",
+                        "operationId": "response_model_none_annotation_return_exact_dict_response_model_none_annotation_return_exact_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model_none-annotation-return_invalid_dict": {
+                    "get": {
+                        "summary": "Response Model None Annotation Return Invalid Dict",
+                        "operationId": "response_model_none_annotation_return_invalid_dict_response_model_none_annotation_return_invalid_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model_none-annotation-return_invalid_model": {
+                    "get": {
+                        "summary": "Response Model None Annotation Return Invalid Model",
+                        "operationId": "response_model_none_annotation_return_invalid_model_response_model_none_annotation_return_invalid_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model_none-annotation-return_dict_with_extra_data": {
+                    "get": {
+                        "summary": "Response Model None Annotation Return Dict With Extra Data",
+                        "operationId": "response_model_none_annotation_return_dict_with_extra_data_response_model_none_annotation_return_dict_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model_none-annotation-return_submodel_with_extra_data": {
+                    "get": {
+                        "summary": "Response Model None Annotation Return Submodel With Extra Data",
+                        "operationId": "response_model_none_annotation_return_submodel_with_extra_data_response_model_none_annotation_return_submodel_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/response_model_model1-annotation_model2-return_same_model": {
+                    "get": {
+                        "summary": "Response Model Model1 Annotation Model2 Return Same Model",
+                        "operationId": "response_model_model1_annotation_model2_return_same_model_response_model_model1_annotation_model2_return_same_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_model1-annotation_model2-return_exact_dict": {
+                    "get": {
+                        "summary": "Response Model Model1 Annotation Model2 Return Exact Dict",
+                        "operationId": "response_model_model1_annotation_model2_return_exact_dict_response_model_model1_annotation_model2_return_exact_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_model1-annotation_model2-return_invalid_dict": {
+                    "get": {
+                        "summary": "Response Model Model1 Annotation Model2 Return Invalid Dict",
+                        "operationId": "response_model_model1_annotation_model2_return_invalid_dict_response_model_model1_annotation_model2_return_invalid_dict_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_model1-annotation_model2-return_invalid_model": {
+                    "get": {
+                        "summary": "Response Model Model1 Annotation Model2 Return Invalid Model",
+                        "operationId": "response_model_model1_annotation_model2_return_invalid_model_response_model_model1_annotation_model2_return_invalid_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_model1-annotation_model2-return_dict_with_extra_data": {
+                    "get": {
+                        "summary": "Response Model Model1 Annotation Model2 Return Dict With Extra Data",
+                        "operationId": "response_model_model1_annotation_model2_return_dict_with_extra_data_response_model_model1_annotation_model2_return_dict_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_model1-annotation_model2-return_submodel_with_extra_data": {
+                    "get": {
+                        "summary": "Response Model Model1 Annotation Model2 Return Submodel With Extra Data",
+                        "operationId": "response_model_model1_annotation_model2_return_submodel_with_extra_data_response_model_model1_annotation_model2_return_submodel_with_extra_data_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_filtering_model-annotation_submodel-return_submodel": {
+                    "get": {
+                        "summary": "Response Model Filtering Model Annotation Submodel Return Submodel",
+                        "operationId": "response_model_filtering_model_annotation_submodel_return_submodel_response_model_filtering_model_annotation_submodel_return_submodel_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_list_of_model-no_annotation": {
+                    "get": {
+                        "summary": "Response Model List Of Model No Annotation",
+                        "operationId": "response_model_list_of_model_no_annotation_response_model_list_of_model_no_annotation_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Response Model List Of Model No Annotation Response Model List Of Model No Annotation Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/User"
+                                            },
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation_list_of_model": {
+                    "get": {
+                        "summary": "No Response Model Annotation List Of Model",
+                        "operationId": "no_response_model_annotation_list_of_model_no_response_model_annotation_list_of_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response No Response Model Annotation List Of Model No Response Model Annotation List Of Model Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/User"
+                                            },
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation_forward_ref_list_of_model": {
+                    "get": {
+                        "summary": "No Response Model Annotation Forward Ref List Of Model",
+                        "operationId": "no_response_model_annotation_forward_ref_list_of_model_no_response_model_annotation_forward_ref_list_of_model_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response No Response Model Annotation Forward Ref List Of Model No Response Model Annotation Forward Ref List Of Model Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/User"
+                                            },
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_union-no_annotation-return_model1": {
+                    "get": {
+                        "summary": "Response Model Union No Annotation Return Model1",
+                        "operationId": "response_model_union_no_annotation_return_model1_response_model_union_no_annotation_return_model1_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Response Model Union No Annotation Return Model1 Response Model Union No Annotation Return Model1 Get",
+                                            "anyOf": [
+                                                {"$ref": "#/components/schemas/User"},
+                                                {"$ref": "#/components/schemas/Item"},
+                                            ],
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/response_model_union-no_annotation-return_model2": {
+                    "get": {
+                        "summary": "Response Model Union No Annotation Return Model2",
+                        "operationId": "response_model_union_no_annotation_return_model2_response_model_union_no_annotation_return_model2_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Response Model Union No Annotation Return Model2 Response Model Union No Annotation Return Model2 Get",
+                                            "anyOf": [
+                                                {"$ref": "#/components/schemas/User"},
+                                                {"$ref": "#/components/schemas/Item"},
+                                            ],
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation_union-return_model1": {
+                    "get": {
+                        "summary": "No Response Model Annotation Union Return Model1",
+                        "operationId": "no_response_model_annotation_union_return_model1_no_response_model_annotation_union_return_model1_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response No Response Model Annotation Union Return Model1 No Response Model Annotation Union Return Model1 Get",
+                                            "anyOf": [
+                                                {"$ref": "#/components/schemas/User"},
+                                                {"$ref": "#/components/schemas/Item"},
+                                            ],
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation_union-return_model2": {
+                    "get": {
+                        "summary": "No Response Model Annotation Union Return Model2",
+                        "operationId": "no_response_model_annotation_union_return_model2_no_response_model_annotation_union_return_model2_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response No Response Model Annotation Union Return Model2 No Response Model Annotation Union Return Model2 Get",
+                                            "anyOf": [
+                                                {"$ref": "#/components/schemas/User"},
+                                                {"$ref": "#/components/schemas/Item"},
+                                            ],
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation_response_class": {
+                    "get": {
+                        "summary": "No Response Model Annotation Response Class",
+                        "operationId": "no_response_model_annotation_response_class_no_response_model_annotation_response_class_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/no_response_model-annotation_json_response_class": {
+                    "get": {
+                        "summary": "No Response Model Annotation Json Response Class",
+                        "operationId": "no_response_model_annotation_json_response_class_no_response_model_annotation_json_response_class_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
             },
-            "/no_response_model-annotation_response_class": {
-                "get": {
-                    "summary": "No Response Model Annotation Response Class",
-                    "operationId": "no_response_model_annotation_response_class_no_response_model_annotation_response_class_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
                     },
-                }
-            },
-            "/no_response_model-annotation_json_response_class": {
-                "get": {
-                    "summary": "No Response Model Annotation Json Response Class",
-                    "operationId": "no_response_model_annotation_json_response_class_no_response_model_annotation_json_response_class_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
+                    "User": {
+                        "title": "User",
+                        "required": ["name", "surname"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "surname": {"title": "Surname", "type": "string"},
+                        },
                     },
                 }
             },
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                    },
-                },
-                "User": {
-                    "title": "User",
-                    "required": ["name", "surname"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "surname": {"title": "Surname", "type": "string"},
-                    },
-                },
-            }
-        },
-    }
+        }
+    )
index 8036bcb07d38bca11c8b11efdb941dd53965c09c..9c7096c5f07838294687fe5cf403ef5f00775aa8 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 
@@ -47,110 +48,114 @@ def test_path_operations():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/valid1": {
-                "get": {
-                    "summary": "Valid1",
-                    "operationId": "valid1_valid1_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "500": {
-                            "description": "Internal Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 500 Valid1 Valid1 Get",
-                                        "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/valid1": {
+                    "get": {
+                        "summary": "Valid1",
+                        "operationId": "valid1_valid1_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "500": {
+                                "description": "Internal Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 500 Valid1 Valid1 Get",
+                                            "type": "integer",
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/valid2": {
-                "get": {
-                    "summary": "Valid2",
-                    "operationId": "valid2_valid2_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "500": {
-                            "description": "Internal Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 500 Valid2 Valid2 Get",
-                                        "type": "array",
-                                        "items": {"type": "integer"},
+                    }
+                },
+                "/valid2": {
+                    "get": {
+                        "summary": "Valid2",
+                        "operationId": "valid2_valid2_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "500": {
+                                "description": "Internal Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 500 Valid2 Valid2 Get",
+                                            "type": "array",
+                                            "items": {"type": "integer"},
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/valid3": {
-                "get": {
-                    "summary": "Valid3",
-                    "operationId": "valid3_valid3_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "500": {
-                            "description": "Internal Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Model"}
-                                }
+                    }
+                },
+                "/valid3": {
+                    "get": {
+                        "summary": "Valid3",
+                        "operationId": "valid3_valid3_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "500": {
+                                "description": "Internal Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Model"}
+                                    }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/valid4": {
-                "get": {
-                    "summary": "Valid4",
-                    "operationId": "valid4_valid4_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "500": {
-                            "description": "Internal Server Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response 500 Valid4 Valid4 Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Model"},
+                    }
+                },
+                "/valid4": {
+                    "get": {
+                        "summary": "Valid4",
+                        "operationId": "valid4_valid4_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "500": {
+                                "description": "Internal Server Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response 500 Valid4 Valid4 Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Model"
+                                            },
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Model": {
-                    "title": "Model",
-                    "required": ["name"],
-                    "type": "object",
-                    "properties": {"name": {"title": "Name", "type": "string"}},
+            "components": {
+                "schemas": {
+                    "Model": {
+                        "title": "Model",
+                        "required": ["name"],
+                        "type": "object",
+                        "properties": {"name": {"title": "Name", "type": "string"}},
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 8caf6ce7af82f601787d13c879bc5f1049ceb573..9ec41e7e84a4d9f0ba1051099177f0a804cca343 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from fastapi import Body, Cookie, FastAPI, Header, Path, Query
 from fastapi.exceptions import FastAPIDeprecationWarning
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, ConfigDict
 
 
@@ -263,592 +264,596 @@ def test_openapi_schema():
     client = TestClient(app)
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/schema_extra/": {
-                "post": {
-                    "summary": "Schema Extra",
-                    "operationId": "schema_extra_schema_extra__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/schema_extra/": {
+                    "post": {
+                        "summary": "Schema Extra",
+                        "operationId": "schema_extra_schema_extra__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/example/": {
-                "post": {
-                    "summary": "Example",
-                    "operationId": "example_example__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"},
-                                "example": {"data": "Data in Body example"},
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/examples/": {
-                "post": {
-                    "summary": "Examples",
-                    "operationId": "examples_examples__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                    "examples": [
-                                        {"data": "Data in Body examples, example1"},
-                                        {"data": "Data in Body examples, example2"},
-                                    ],
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/example/": {
+                    "post": {
+                        "summary": "Example",
+                        "operationId": "example_example__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"},
+                                    "example": {"data": "Data in Body example"},
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/example_examples/": {
-                "post": {
-                    "summary": "Example Examples",
-                    "operationId": "example_examples_example_examples__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                    "examples": [
-                                        {"data": "examples example_examples 1"},
-                                        {"data": "examples example_examples 2"},
-                                    ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
                                 },
-                                "example": {"data": "Overridden example"},
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/examples/": {
+                    "post": {
+                        "summary": "Examples",
+                        "operationId": "examples_examples__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Item",
+                                        "examples": [
+                                            {"data": "Data in Body examples, example1"},
+                                            {"data": "Data in Body examples, example2"},
+                                        ],
                                     }
                                 }
                             },
-                        },
-                    },
-                }
-            },
-            "/path_example/{item_id}": {
-                "get": {
-                    "summary": "Path Example",
-                    "operationId": "path_example_path_example__item_id__get",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "example": "item_1",
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/path_examples/{item_id}": {
-                "get": {
-                    "summary": "Path Examples",
-                    "operationId": "path_examples_path_examples__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "string",
-                                "examples": ["item_1", "item_2"],
-                            },
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/example_examples/": {
+                    "post": {
+                        "summary": "Example Examples",
+                        "operationId": "example_examples_example_examples__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                        "$ref": "#/components/schemas/Item",
+                                        "examples": [
+                                            {"data": "examples example_examples 1"},
+                                            {"data": "examples example_examples 2"},
+                                        ],
+                                    },
+                                    "example": {"data": "Overridden example"},
                                 }
                             },
-                        },
-                    },
-                }
-            },
-            "/path_example_examples/{item_id}": {
-                "get": {
-                    "summary": "Path Example Examples",
-                    "operationId": "path_example_examples_path_example_examples__item_id__get",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "string",
-                                "examples": ["item_1", "item_2"],
-                            },
-                            "example": "item_overridden",
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/query_example/": {
-                "get": {
-                    "summary": "Query Example",
-                    "operationId": "query_example_query_example__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                            },
-                            "example": "query1",
-                            "name": "data",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/path_example/{item_id}": {
+                    "get": {
+                        "summary": "Path Example",
+                        "operationId": "path_example_path_example__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "example": "item_1",
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/query_examples/": {
-                "get": {
-                    "summary": "Query Examples",
-                    "operationId": "query_examples_query_examples__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                                "examples": ["query1", "query2"],
-                            },
-                            "name": "data",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/path_examples/{item_id}": {
+                    "get": {
+                        "summary": "Path Examples",
+                        "operationId": "path_examples_path_examples__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "string",
+                                    "examples": ["item_1", "item_2"],
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/query_example_examples/": {
-                "get": {
-                    "summary": "Query Example Examples",
-                    "operationId": "query_example_examples_query_example_examples__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                                "examples": ["query1", "query2"],
-                            },
-                            "example": "query_overridden",
-                            "name": "data",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/path_example_examples/{item_id}": {
+                    "get": {
+                        "summary": "Path Example Examples",
+                        "operationId": "path_example_examples_path_example_examples__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "string",
+                                    "examples": ["item_1", "item_2"],
+                                },
+                                "example": "item_overridden",
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/header_example/": {
-                "get": {
-                    "summary": "Header Example",
-                    "operationId": "header_example_header_example__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                            },
-                            "example": "header1",
-                            "name": "data",
-                            "in": "header",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/query_example/": {
+                    "get": {
+                        "summary": "Query Example",
+                        "operationId": "query_example_query_example__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                },
+                                "example": "query1",
+                                "name": "data",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/header_examples/": {
-                "get": {
-                    "summary": "Header Examples",
-                    "operationId": "header_examples_header_examples__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                                "examples": ["header1", "header2"],
-                            },
-                            "name": "data",
-                            "in": "header",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/query_examples/": {
+                    "get": {
+                        "summary": "Query Examples",
+                        "operationId": "query_examples_query_examples__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                    "examples": ["query1", "query2"],
+                                },
+                                "name": "data",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/header_example_examples/": {
-                "get": {
-                    "summary": "Header Example Examples",
-                    "operationId": "header_example_examples_header_example_examples__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                                "examples": ["header1", "header2"],
-                            },
-                            "example": "header_overridden",
-                            "name": "data",
-                            "in": "header",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/query_example_examples/": {
+                    "get": {
+                        "summary": "Query Example Examples",
+                        "operationId": "query_example_examples_query_example_examples__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                    "examples": ["query1", "query2"],
+                                },
+                                "example": "query_overridden",
+                                "name": "data",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/cookie_example/": {
-                "get": {
-                    "summary": "Cookie Example",
-                    "operationId": "cookie_example_cookie_example__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                            },
-                            "example": "cookie1",
-                            "name": "data",
-                            "in": "cookie",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/header_example/": {
+                    "get": {
+                        "summary": "Header Example",
+                        "operationId": "header_example_header_example__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                },
+                                "example": "header1",
+                                "name": "data",
+                                "in": "header",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/header_examples/": {
+                    "get": {
+                        "summary": "Header Examples",
+                        "operationId": "header_examples_header_examples__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                    "examples": ["header1", "header2"],
+                                },
+                                "name": "data",
+                                "in": "header",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/cookie_examples/": {
-                "get": {
-                    "summary": "Cookie Examples",
-                    "operationId": "cookie_examples_cookie_examples__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                                "examples": ["cookie1", "cookie2"],
-                            },
-                            "name": "data",
-                            "in": "cookie",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/header_example_examples/": {
+                    "get": {
+                        "summary": "Header Example Examples",
+                        "operationId": "header_example_examples_header_example_examples__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                    "examples": ["header1", "header2"],
+                                },
+                                "example": "header_overridden",
+                                "name": "data",
+                                "in": "header",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/cookie_example/": {
+                    "get": {
+                        "summary": "Cookie Example",
+                        "operationId": "cookie_example_cookie_example__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                },
+                                "example": "cookie1",
+                                "name": "data",
+                                "in": "cookie",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/cookie_example_examples/": {
-                "get": {
-                    "summary": "Cookie Example Examples",
-                    "operationId": "cookie_example_examples_cookie_example_examples__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Data",
-                                "examples": ["cookie1", "cookie2"],
-                            },
-                            "example": "cookie_overridden",
-                            "name": "data",
-                            "in": "cookie",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/cookie_examples/": {
+                    "get": {
+                        "summary": "Cookie Examples",
+                        "operationId": "cookie_examples_cookie_examples__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                    "examples": ["cookie1", "cookie2"],
+                                },
+                                "name": "data",
+                                "in": "cookie",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/cookie_example_examples/": {
+                    "get": {
+                        "summary": "Cookie Example Examples",
+                        "operationId": "cookie_example_examples_cookie_example_examples__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Data",
+                                    "examples": ["cookie1", "cookie2"],
+                                },
+                                "example": "cookie_overridden",
+                                "name": "data",
+                                "in": "cookie",
+                            }
+                        ],
+                        "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"},
-                        }
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["data"],
-                    "type": "object",
-                    "properties": {"data": {"title": "Data", "type": "string"}},
-                    "example": {"data": "Data in schema_extra"},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "Item": {
+                        "title": "Item",
+                        "required": ["data"],
+                        "type": "object",
+                        "properties": {"data": {"title": "Data", "type": "string"}},
+                        "example": {"data": "Data in schema_extra"},
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 9bacfc56ecd8e9d68a5d9ee08d1e9aa48a48955e..e37e113b8e936792cea6e866abbecc7f1a536a1f 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyCookie
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -41,27 +42,29 @@ def test_openapi_schema():
     client = TestClient(app)
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyCookie": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyCookie": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyCookie": {"type": "apiKey", "name": "key", "in": "cookie"}
-            }
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyCookie": {"type": "apiKey", "name": "key", "in": "cookie"}
+                }
+            },
+        }
+    )
index d0cab324eb7b6dd78051634953406dfe427f5187..b12dce4bf5917e011d72b1a79f276cb9b870dae5 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyCookie
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -41,32 +42,34 @@ def test_openapi_schema():
     client = TestClient(app)
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyCookie": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyCookie": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyCookie": {
-                    "type": "apiKey",
-                    "name": "key",
-                    "in": "cookie",
-                    "description": "An API Cookie Key",
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyCookie": {
+                        "type": "apiKey",
+                        "name": "key",
+                        "in": "cookie",
+                        "description": "An API Cookie Key",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index cb5590168d30cc755912ad8315483c54899abc53..7988d80443b96a63f30d36917effad83f3e5f9de 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyCookie
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -47,27 +48,29 @@ def test_openapi_schema():
     client = TestClient(app)
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyCookie": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyCookie": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyCookie": {"type": "apiKey", "name": "key", "in": "cookie"}
-            }
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyCookie": {"type": "apiKey", "name": "key", "in": "cookie"}
+                }
+            },
+        }
+    )
index 3e761b150bfb6574f7a979e204cb99db9144904a..a53a2a227984af9bc2bd16ca17a9d019d0625bec 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyHeader
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -41,27 +42,29 @@ def test_security_api_key_no_key():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyHeader": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyHeader": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyHeader": {"type": "apiKey", "name": "key", "in": "header"}
-            }
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyHeader": {"type": "apiKey", "name": "key", "in": "header"}
+                }
+            },
+        }
+    )
index 38a1a88814e7d8bc042e1eb3a2657204e18ed196..0052dbcfc4279ee1a9dd8e3a55e575ccd049028a 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyHeader
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -41,32 +42,34 @@ def test_security_api_key_no_key():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyHeader": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyHeader": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyHeader": {
-                    "type": "apiKey",
-                    "name": "key",
-                    "in": "header",
-                    "description": "An API Key Header",
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyHeader": {
+                        "type": "apiKey",
+                        "name": "key",
+                        "in": "header",
+                        "description": "An API Key Header",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 6f9682a64fef3d5e068545eff4080c65a2b3200a..51abd0bb964a6ba84d7aa83c7d4abd9dfd317772 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyHeader
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -46,27 +47,29 @@ def test_security_api_key_no_key():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyHeader": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyHeader": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyHeader": {"type": "apiKey", "name": "key", "in": "header"}
-            }
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyHeader": {"type": "apiKey", "name": "key", "in": "header"}
+                }
+            },
+        }
+    )
index 11ed194689eb37544f6b09f019931f6197f94bc6..c3cb855fc758a6a96327f5da3d6eeb405067de73 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyQuery
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -41,27 +42,29 @@ def test_security_api_key_no_key():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyQuery": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyQuery": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyQuery": {"type": "apiKey", "name": "key", "in": "query"}
-            }
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyQuery": {"type": "apiKey", "name": "key", "in": "query"}
+                }
+            },
+        }
+    )
index 658798326109b82915b9e86b9684c0cd6ee7b694..f775a4feaa5fcaa17c1092c5dc33d6a8e2f795ce 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyQuery
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -41,32 +42,34 @@ def test_security_api_key_no_key():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyQuery": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyQuery": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyQuery": {
-                    "type": "apiKey",
-                    "name": "key",
-                    "in": "query",
-                    "description": "API Key Query",
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyQuery": {
+                        "type": "apiKey",
+                        "name": "key",
+                        "in": "query",
+                        "description": "API Key Query",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 4cc134bd49ab98dc661f08db527f8afdca5da4f7..26fbb9ee4fae08b6c6c4b6d5d95038df3cee41d1 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import APIKeyQuery
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -46,27 +47,29 @@ def test_security_api_key_no_key():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"APIKeyQuery": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"APIKeyQuery": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "APIKeyQuery": {"type": "apiKey", "name": "key", "in": "query"}
-            }
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {
+                    "APIKeyQuery": {"type": "apiKey", "name": "key", "in": "query"}
+                }
+            },
+        }
+    )
index ac38ee718e3677fbf88bf58b79966a54172719bc..fff6f0ee54a0b376a3053498161dc0c538bd2507 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Security
 from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -37,25 +38,27 @@ def test_security_http_base_no_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBase": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBase": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBase": {"type": "http", "scheme": "Other"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBase": {"type": "http", "scheme": "Other"}}
+            },
+        }
+    )
index 791ea59f4db9d456f160bae6925d131202e72e10..b03636a619dab0212f758ede33366c590db6f557 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Security
 from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -31,31 +32,33 @@ def test_security_http_base_no_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBase": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBase": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "HTTPBase": {
-                    "type": "http",
-                    "scheme": "Other",
-                    "description": "Other Security Scheme",
+            },
+            "components": {
+                "securitySchemes": {
+                    "HTTPBase": {
+                        "type": "http",
+                        "scheme": "Other",
+                        "description": "Other Security Scheme",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index dd4d76843ab2922b8c6acb8f43b2415b832a1921..612a7909fef0b0243e668fd1d7067b3310310312 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -36,25 +37,27 @@ def test_security_http_base_no_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBase": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBase": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBase": {"type": "http", "scheme": "Other"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBase": {"type": "http", "scheme": "Other"}}
+            },
+        }
+    )
index 7071f381a1333cc21f4d8c248f9e4c9c64951cfe..e94565c7bb997b787f0e3b967b19c19e739b335a 100644 (file)
@@ -4,6 +4,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPBasic, HTTPBasicCredentials
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -53,25 +54,27 @@ def test_security_http_basic_non_basic_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBasic": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBasic": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
+            },
+        }
+    )
index ec7371f90fec2e91d86a98e3b6b72e68a6868187..0e328cdd95691bb1d063f6aa45be35ac96edd29d 100644 (file)
@@ -3,6 +3,7 @@ from base64 import b64encode
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPBasic, HTTPBasicCredentials
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -51,25 +52,27 @@ def test_security_http_basic_non_basic_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBasic": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBasic": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
+            },
+        }
+    )
index a93d5fc86bdefda3f2e45212102c075cc73aa40d..5423d9b8d07e8951ed68ba406914a27d11b91fdc 100644 (file)
@@ -3,6 +3,7 @@ from base64 import b64encode
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPBasic, HTTPBasicCredentials
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -51,31 +52,33 @@ def test_security_http_basic_non_basic_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBasic": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBasic": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "HTTPBasic": {
-                    "type": "http",
-                    "scheme": "basic",
-                    "description": "HTTPBasic scheme",
+            },
+            "components": {
+                "securitySchemes": {
+                    "HTTPBasic": {
+                        "type": "http",
+                        "scheme": "basic",
+                        "description": "HTTPBasic scheme",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 961b42f4db35a343b253b009c6c152c456824cda..eb94ddc3d9c77efa14f7e11141e6326b06b53737 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -38,25 +39,27 @@ def test_security_http_bearer_incorrect_scheme_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBearer": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBearer": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBearer": {"type": "http", "scheme": "bearer"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBearer": {"type": "http", "scheme": "bearer"}}
+            },
+        }
+    )
index e16994abce5f0b9e190b2d1bc614fa58772622f1..47fc141079e0fe8b96a6379a25dca3ba4e14cf73 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -38,31 +39,33 @@ def test_security_http_bearer_incorrect_scheme_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBearer": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBearer": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "HTTPBearer": {
-                    "type": "http",
-                    "scheme": "bearer",
-                    "description": "HTTP Bearer token scheme",
+            },
+            "components": {
+                "securitySchemes": {
+                    "HTTPBearer": {
+                        "type": "http",
+                        "scheme": "bearer",
+                        "description": "HTTP Bearer token scheme",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 943da2ee2e93e18c9280506b9ec208a35060b8aa..b49a6593ec652f79e1c0a08d772a6a3e72edd791 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -42,25 +43,27 @@ def test_security_http_bearer_incorrect_scheme_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBearer": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBearer": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBearer": {"type": "http", "scheme": "bearer"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBearer": {"type": "http", "scheme": "bearer"}}
+            },
+        }
+    )
index 3fad4c7a564ba702559a53355323acd5ee9553a2..345ae9c171f83c75e34ecbd839b437af609f2ffd 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPAuthorizationCredentials, HTTPDigest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -40,25 +41,27 @@ def test_security_http_digest_incorrect_scheme_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPDigest": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPDigest": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPDigest": {"type": "http", "scheme": "digest"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPDigest": {"type": "http", "scheme": "digest"}}
+            },
+        }
+    )
index 319416a0718c6658a5661c95e518539dd7f76f03..1219bd40e3d4800c15025b61bebd8cb77b070d17 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPAuthorizationCredentials, HTTPDigest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -40,31 +41,33 @@ def test_security_http_digest_incorrect_scheme_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPDigest": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPDigest": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "HTTPDigest": {
-                    "type": "http",
-                    "scheme": "digest",
-                    "description": "HTTPDigest scheme",
+            },
+            "components": {
+                "securitySchemes": {
+                    "HTTPDigest": {
+                        "type": "http",
+                        "scheme": "digest",
+                        "description": "HTTPDigest scheme",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 0d66f9c72e5652e1a34a3b423388bc27a5a7130a..97e62634d830c14190d8e6d784b87e3fe26d8853 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPAuthorizationCredentials, HTTPDigest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -44,25 +45,27 @@ def test_security_http_digest_incorrect_scheme_credentials():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPDigest": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPDigest": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPDigest": {"type": "http", "scheme": "digest"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPDigest": {"type": "http", "scheme": "digest"}}
+            },
+        }
+    )
index bff1226ad93ebf8a40ebcb3317557d66f560b6e6..1c216e95d838819e58f6a0b46e1c7ce10801eb53 100644 (file)
@@ -2,6 +2,7 @@ import pytest
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -148,124 +149,132 @@ def test_strict_login_correct_grant_type():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/login": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/login": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_login_post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_login_login_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_login_post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_login_login_post"
-                                }
+                    }
+                },
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                }
-            },
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"OAuth2": []}],
-                }
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"OAuth2": []}],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_login_login_post": {
-                    "title": "Body_login_login_post",
-                    "required": ["grant_type", "username", "password"],
-                    "type": "object",
-                    "properties": {
-                        "grant_type": {
-                            "title": "Grant Type",
-                            "pattern": "^password$",
-                            "type": "string",
-                        },
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {"title": "Password", "type": "string"},
-                        "scope": {"title": "Scope", "type": "string", "default": ""},
-                        "client_id": {
-                            "title": "Client Id",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "client_secret": {
-                            "title": "Client Secret",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            "components": {
+                "schemas": {
+                    "Body_login_login_post": {
+                        "title": "Body_login_login_post",
+                        "required": ["grant_type", "username", "password"],
+                        "type": "object",
+                        "properties": {
+                            "grant_type": {
+                                "title": "Grant Type",
+                                "pattern": "^password$",
+                                "type": "string",
+                            },
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {"title": "Password", "type": "string"},
+                            "scope": {
+                                "title": "Scope",
+                                "type": "string",
+                                "default": "",
+                            },
+                            "client_id": {
+                                "title": "Client Id",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "client_secret": {
+                                "title": "Client Secret",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
                 },
+                "securitySchemes": {
+                    "OAuth2": {
+                        "type": "oauth2",
+                        "flows": {
+                            "password": {
+                                "scopes": {
+                                    "read:users": "Read the users",
+                                    "write:users": "Create users",
+                                },
+                                "tokenUrl": "token",
+                            }
+                        },
+                    }
+                },
             },
-            "securitySchemes": {
-                "OAuth2": {
-                    "type": "oauth2",
-                    "flows": {
-                        "password": {
-                            "scopes": {
-                                "read:users": "Read the users",
-                                "write:users": "Create users",
-                            },
-                            "tokenUrl": "token",
-                        }
-                    },
-                }
-            },
-        },
-    }
+        }
+    )
index 66f53ab00db5c4a80166abe20b79c38bee20af0f..1ba577e9fff49135d44ad88b39371682bf392a98 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import OAuth2AuthorizationCodeBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -46,36 +47,38 @@ def test_token_with_whitespaces():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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": [{"OAuth2AuthorizationCodeBearer": []}],
+    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": [{"OAuth2AuthorizationCodeBearer": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "OAuth2AuthorizationCodeBearer": {
-                    "type": "oauth2",
-                    "flows": {
-                        "authorizationCode": {
-                            "authorizationUrl": "authorize",
-                            "tokenUrl": "token",
-                            "scopes": {},
-                        }
-                    },
+            },
+            "components": {
+                "securitySchemes": {
+                    "OAuth2AuthorizationCodeBearer": {
+                        "type": "oauth2",
+                        "flows": {
+                            "authorizationCode": {
+                                "authorizationUrl": "authorize",
+                                "tokenUrl": "token",
+                                "scopes": {},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 5386fbbd9db6253296acb0587f23d2290c84e420..73807c31a336e978db8403c424b1ac0e029a2eb7 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import OAuth2AuthorizationCodeBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -43,37 +44,39 @@ def test_token():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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": [{"OAuth2AuthorizationCodeBearer": []}],
+    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": [{"OAuth2AuthorizationCodeBearer": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "OAuth2AuthorizationCodeBearer": {
-                    "type": "oauth2",
-                    "flows": {
-                        "authorizationCode": {
-                            "authorizationUrl": "authorize",
-                            "tokenUrl": "token",
-                            "scopes": {},
-                        }
-                    },
-                    "description": "OAuth2 Code Bearer",
+            },
+            "components": {
+                "securitySchemes": {
+                    "OAuth2AuthorizationCodeBearer": {
+                        "type": "oauth2",
+                        "flows": {
+                            "authorizationCode": {
+                                "authorizationUrl": "authorize",
+                                "tokenUrl": "token",
+                                "scopes": {},
+                            }
+                        },
+                        "description": "OAuth2 Code Bearer",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 5bcd5040fd70ab6fe9941babdb07fc64fb0c120e..cb79afdb86938877f7bc21a82f5424b7b46abf68 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -151,124 +152,132 @@ def test_strict_login_correct_data():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/login": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/login": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_login_post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_login_login_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_login_post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_login_login_post"
-                                }
+                    }
+                },
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                }
-            },
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Users Me",
-                    "operationId": "read_users_me_users_me_get",
-                    "security": [{"OAuth2": []}],
-                }
+                        "summary": "Read Users Me",
+                        "operationId": "read_users_me_users_me_get",
+                        "security": [{"OAuth2": []}],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_login_login_post": {
-                    "title": "Body_login_login_post",
-                    "required": ["grant_type", "username", "password"],
-                    "type": "object",
-                    "properties": {
-                        "grant_type": {
-                            "title": "Grant Type",
-                            "pattern": "^password$",
-                            "type": "string",
-                        },
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {"title": "Password", "type": "string"},
-                        "scope": {"title": "Scope", "type": "string", "default": ""},
-                        "client_id": {
-                            "title": "Client Id",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "client_secret": {
-                            "title": "Client Secret",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            "components": {
+                "schemas": {
+                    "Body_login_login_post": {
+                        "title": "Body_login_login_post",
+                        "required": ["grant_type", "username", "password"],
+                        "type": "object",
+                        "properties": {
+                            "grant_type": {
+                                "title": "Grant Type",
+                                "pattern": "^password$",
+                                "type": "string",
+                            },
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {"title": "Password", "type": "string"},
+                            "scope": {
+                                "title": "Scope",
+                                "type": "string",
+                                "default": "",
+                            },
+                            "client_id": {
+                                "title": "Client Id",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "client_secret": {
+                                "title": "Client Secret",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
                 },
+                "securitySchemes": {
+                    "OAuth2": {
+                        "type": "oauth2",
+                        "flows": {
+                            "password": {
+                                "scopes": {
+                                    "read:users": "Read the users",
+                                    "write:users": "Create users",
+                                },
+                                "tokenUrl": "token",
+                            }
+                        },
+                    }
+                },
             },
-            "securitySchemes": {
-                "OAuth2": {
-                    "type": "oauth2",
-                    "flows": {
-                        "password": {
-                            "scopes": {
-                                "read:users": "Read the users",
-                                "write:users": "Create users",
-                            },
-                            "tokenUrl": "token",
-                        }
-                    },
-                }
-            },
-        },
-    }
+        }
+    )
index 0353ba4c2716e5fd95dcb9f3293434abf2287cc8..b3fae37a170be54830998cc40c3a68cb4cfa3aa9 100644 (file)
@@ -4,6 +4,7 @@ import pytest
 from fastapi import Depends, FastAPI, Security
 from fastapi.security import OAuth2, OAuth2PasswordRequestFormStrict
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -152,125 +153,133 @@ def test_strict_login_correct_correct_grant_type():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/login": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/login": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_login_post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_login_login_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_login_post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_login_login_post"
-                                }
+                    }
+                },
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                }
-            },
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Users Me",
-                    "operationId": "read_users_me_users_me_get",
-                    "security": [{"OAuth2": []}],
-                }
+                        "summary": "Read Users Me",
+                        "operationId": "read_users_me_users_me_get",
+                        "security": [{"OAuth2": []}],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_login_login_post": {
-                    "title": "Body_login_login_post",
-                    "required": ["grant_type", "username", "password"],
-                    "type": "object",
-                    "properties": {
-                        "grant_type": {
-                            "title": "Grant Type",
-                            "pattern": "^password$",
-                            "type": "string",
-                        },
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {"title": "Password", "type": "string"},
-                        "scope": {"title": "Scope", "type": "string", "default": ""},
-                        "client_id": {
-                            "title": "Client Id",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "client_secret": {
-                            "title": "Client Secret",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            "components": {
+                "schemas": {
+                    "Body_login_login_post": {
+                        "title": "Body_login_login_post",
+                        "required": ["grant_type", "username", "password"],
+                        "type": "object",
+                        "properties": {
+                            "grant_type": {
+                                "title": "Grant Type",
+                                "pattern": "^password$",
+                                "type": "string",
+                            },
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {"title": "Password", "type": "string"},
+                            "scope": {
+                                "title": "Scope",
+                                "type": "string",
+                                "default": "",
+                            },
+                            "client_id": {
+                                "title": "Client Id",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "client_secret": {
+                                "title": "Client Secret",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
                 },
+                "securitySchemes": {
+                    "OAuth2": {
+                        "type": "oauth2",
+                        "flows": {
+                            "password": {
+                                "scopes": {
+                                    "read:users": "Read the users",
+                                    "write:users": "Create users",
+                                },
+                                "tokenUrl": "token",
+                            }
+                        },
+                        "description": "OAuth2 security scheme",
+                    }
+                },
             },
-            "securitySchemes": {
-                "OAuth2": {
-                    "type": "oauth2",
-                    "flows": {
-                        "password": {
-                            "scopes": {
-                                "read:users": "Read the users",
-                                "write:users": "Create users",
-                            },
-                            "tokenUrl": "token",
-                        }
-                    },
-                    "description": "OAuth2 security scheme",
-                }
-            },
-        },
-    }
+        }
+    )
index 4c9362c3eb0a868d80ab6c1d30c226dbf13a8c9c..01e2f65ed97ed36ab08b936f08e8654a675b85a4 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import OAuth2PasswordBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -40,30 +41,32 @@ def test_incorrect_token():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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": []}],
+    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"}},
+            },
+            "components": {
+                "securitySchemes": {
+                    "OAuth2PasswordBearer": {
+                        "type": "oauth2",
+                        "flows": {"password": {"scopes": {}, "tokenUrl": "/token"}},
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 6e6ea846cd33d1f5c07dc58ef2dc502df743e1c4..fec8d03a7a0bee43b1cdfc42f6ee5cf299e3b7c2 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import FastAPI, Security
 from fastapi.security import OAuth2PasswordBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 app = FastAPI()
 
@@ -44,31 +45,33 @@ def test_incorrect_token():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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": []}],
+    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"}},
-                    "description": "OAuth2PasswordBearer security scheme",
+            },
+            "components": {
+                "securitySchemes": {
+                    "OAuth2PasswordBearer": {
+                        "type": "oauth2",
+                        "flows": {"password": {"scopes": {}, "tokenUrl": "/token"}},
+                        "description": "OAuth2PasswordBearer security scheme",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index c9a0a8db7619abfbcb1b507b485ac08deb0f530c..2c8bcd494eead419b873b6153517c95ffdcc03b3 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security.open_id_connect_url import OpenIdConnect
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -47,30 +48,32 @@ def test_security_oauth2_password_bearer_no_header():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"OpenIdConnect": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"OpenIdConnect": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "OpenIdConnect": {
-                    "type": "openIdConnect",
-                    "openIdConnectUrl": "/openid",
+            },
+            "components": {
+                "securitySchemes": {
+                    "OpenIdConnect": {
+                        "type": "openIdConnect",
+                        "openIdConnectUrl": "/openid",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index d008cbc630356c0cde0f0f86528994ec84b5db9f..4f69c82ff90066df9714668193b5c0a49d73b9db 100644 (file)
@@ -1,6 +1,7 @@
 from fastapi import Depends, FastAPI, Security
 from fastapi.security.open_id_connect_url import OpenIdConnect
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -49,31 +50,33 @@ def test_security_oauth2_password_bearer_no_header():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"OpenIdConnect": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"OpenIdConnect": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "OpenIdConnect": {
-                    "type": "openIdConnect",
-                    "openIdConnectUrl": "/openid",
-                    "description": "OpenIdConnect security scheme",
+            },
+            "components": {
+                "securitySchemes": {
+                    "OpenIdConnect": {
+                        "type": "openIdConnect",
+                        "openIdConnectUrl": "/openid",
+                        "description": "OpenIdConnect security scheme",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index e817434b0dac9ae551940841a67b1c3b4efa4dd4..ebaf394dc99569f7ae2a658f81d543d6624382c0 100644 (file)
@@ -3,6 +3,7 @@ from typing import Optional
 from fastapi import Depends, FastAPI, Security
 from fastapi.security.open_id_connect_url import OpenIdConnect
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -52,30 +53,32 @@ def test_security_oauth2_password_bearer_no_header():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"OpenIdConnect": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"OpenIdConnect": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "OpenIdConnect": {
-                    "type": "openIdConnect",
-                    "openIdConnectUrl": "/openid",
+            },
+            "components": {
+                "securitySchemes": {
+                    "OpenIdConnect": {
+                        "type": "openIdConnect",
+                        "openIdConnectUrl": "/openid",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 2be37b8bb83b59064bdb9790600d8c1742ca37d2..95c780c0d4954b844445e687809f31bc5e70a34e 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI, HTTPException
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from starlette.exceptions import HTTPException as StarletteHTTPException
 
 app = FastAPI()
@@ -79,126 +80,130 @@ def test_no_body_status_code_with_detail_exception_handlers():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/http-no-body-statuscode-exception": {
-                "get": {
-                    "operationId": "no_body_status_code_exception_http_no_body_statuscode_exception_get",
-                    "responses": {
-                        "200": {
-                            "content": {"application/json": {"schema": {}}},
-                            "description": "Successful Response",
-                        }
-                    },
-                    "summary": "No Body Status Code Exception",
-                }
-            },
-            "/http-no-body-statuscode-with-detail-exception": {
-                "get": {
-                    "operationId": "no_body_status_code_with_detail_exception_http_no_body_statuscode_with_detail_exception_get",
-                    "responses": {
-                        "200": {
-                            "content": {"application/json": {"schema": {}}},
-                            "description": "Successful Response",
-                        }
-                    },
-                    "summary": "No Body Status Code With Detail Exception",
-                }
-            },
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/http-no-body-statuscode-exception": {
+                    "get": {
+                        "operationId": "no_body_status_code_exception_http_no_body_statuscode_exception_get",
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            }
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "No Body Status Code Exception",
+                    }
+                },
+                "/http-no-body-statuscode-with-detail-exception": {
+                    "get": {
+                        "operationId": "no_body_status_code_with_detail_exception_http_no_body_statuscode_with_detail_exception_get",
+                        "responses": {
+                            "200": {
+                                "content": {"application/json": {"schema": {}}},
+                                "description": "Successful Response",
+                            }
+                        },
+                        "summary": "No Body Status Code With Detail Exception",
+                    }
+                },
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
-            },
-            "/starlette-items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
+                "/starlette-items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Starlette Item",
-                    "operationId": "read_starlette_item_starlette_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                }
+                        "summary": "Read Starlette Item",
+                        "operationId": "read_starlette_item_starlette_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 442e709fb16de242c31104244d27afb483f39f46..86dc4d00e27fe7d625e8e50fb1221f5c2d5d2b4d 100644 (file)
@@ -2,6 +2,7 @@ from typing import Optional
 
 from fastapi import APIRouter, FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel, HttpUrl
 
 app = FastAPI()
@@ -86,210 +87,222 @@ def test_get():
 def test_openapi_schema():
     with client:
         response = client.get("/openapi.json")
-        assert response.json() == {
-            "openapi": "3.1.0",
-            "info": {"title": "FastAPI", "version": "0.1.0"},
-            "paths": {
-                "/invoices/": {
-                    "post": {
-                        "summary": "Create Invoice",
-                        "description": 'Create an invoice.\n\nThis will (let\'s imagine) let the API user (some external developer) create an\ninvoice.\n\nAnd this path operation will:\n\n* Send the invoice to the client.\n* Collect the money from the client.\n* Send a notification back to the API user (the external developer), as a callback.\n    * At this point is that the API will somehow send a POST request to the\n        external API with the notification of the invoice event\n        (e.g. "payment successful").',
-                        "operationId": "create_invoice_invoices__post",
-                        "parameters": [
-                            {
-                                "required": False,
-                                "schema": {
-                                    "title": "Callback Url",
-                                    "anyOf": [
-                                        {
-                                            "type": "string",
-                                            "format": "uri",
-                                            "minLength": 1,
-                                            "maxLength": 2083,
-                                        },
-                                        {"type": "null"},
-                                    ],
-                                },
-                                "name": "callback_url",
-                                "in": "query",
-                            }
-                        ],
-                        "requestBody": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Invoice"}
+        assert response.json() == snapshot(
+            {
+                "openapi": "3.1.0",
+                "info": {"title": "FastAPI", "version": "0.1.0"},
+                "paths": {
+                    "/invoices/": {
+                        "post": {
+                            "summary": "Create Invoice",
+                            "description": 'Create an invoice.\n\nThis will (let\'s imagine) let the API user (some external developer) create an\ninvoice.\n\nAnd this path operation will:\n\n* Send the invoice to the client.\n* Collect the money from the client.\n* Send a notification back to the API user (the external developer), as a callback.\n    * At this point is that the API will somehow send a POST request to the\n        external API with the notification of the invoice event\n        (e.g. "payment successful").',
+                            "operationId": "create_invoice_invoices__post",
+                            "parameters": [
+                                {
+                                    "required": False,
+                                    "schema": {
+                                        "title": "Callback Url",
+                                        "anyOf": [
+                                            {
+                                                "type": "string",
+                                                "format": "uri",
+                                                "minLength": 1,
+                                                "maxLength": 2083,
+                                            },
+                                            {"type": "null"},
+                                        ],
+                                    },
+                                    "name": "callback_url",
+                                    "in": "query",
                                 }
-                            },
-                            "required": True,
-                        },
-                        "responses": {
-                            "200": {
-                                "description": "Successful Response",
-                                "content": {"application/json": {"schema": {}}},
-                            },
-                            "422": {
-                                "description": "Validation Error",
+                            ],
+                            "requestBody": {
                                 "content": {
                                     "application/json": {
                                         "schema": {
-                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                            "$ref": "#/components/schemas/Invoice"
                                         }
                                     }
                                 },
+                                "required": True,
                             },
-                        },
-                        "callbacks": {
-                            "event_callback": {
-                                "{$callback_url}/events/{$request.body.title}": {
-                                    "get": {
-                                        "summary": "Event Callback",
-                                        "operationId": "event_callback__callback_url__events___request_body_title__get",
-                                        "requestBody": {
-                                            "required": True,
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/Event"
-                                                    }
-                                                }
-                                            },
-                                        },
-                                        "responses": {
-                                            "200": {
-                                                "description": "Successful Response",
-                                                "content": {
-                                                    "application/json": {"schema": {}}
-                                                },
-                                            },
-                                            "422": {
-                                                "description": "Validation Error",
+                            "responses": {
+                                "200": {
+                                    "description": "Successful Response",
+                                    "content": {"application/json": {"schema": {}}},
+                                },
+                                "422": {
+                                    "description": "Validation Error",
+                                    "content": {
+                                        "application/json": {
+                                            "schema": {
+                                                "$ref": "#/components/schemas/HTTPValidationError"
+                                            }
+                                        }
+                                    },
+                                },
+                            },
+                            "callbacks": {
+                                "event_callback": {
+                                    "{$callback_url}/events/{$request.body.title}": {
+                                        "get": {
+                                            "summary": "Event Callback",
+                                            "operationId": "event_callback__callback_url__events___request_body_title__get",
+                                            "requestBody": {
+                                                "required": True,
                                                 "content": {
                                                     "application/json": {
                                                         "schema": {
-                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                                            "$ref": "#/components/schemas/Event"
                                                         }
                                                     }
                                                 },
                                             },
-                                        },
-                                    }
-                                }
-                            },
-                            "invoice_notification": {
-                                "{$callback_url}/invoices/{$request.body.id}": {
-                                    "post": {
-                                        "summary": "Invoice Notification",
-                                        "operationId": "invoice_notification__callback_url__invoices___request_body_id__post",
-                                        "requestBody": {
-                                            "required": True,
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/InvoiceEvent"
-                                                    }
-                                                }
+                                            "responses": {
+                                                "200": {
+                                                    "description": "Successful Response",
+                                                    "content": {
+                                                        "application/json": {
+                                                            "schema": {}
+                                                        }
+                                                    },
+                                                },
+                                                "422": {
+                                                    "description": "Validation Error",
+                                                    "content": {
+                                                        "application/json": {
+                                                            "schema": {
+                                                                "$ref": "#/components/schemas/HTTPValidationError"
+                                                            }
+                                                        }
+                                                    },
+                                                },
                                             },
-                                        },
-                                        "responses": {
-                                            "200": {
-                                                "description": "Successful Response",
+                                        }
+                                    }
+                                },
+                                "invoice_notification": {
+                                    "{$callback_url}/invoices/{$request.body.id}": {
+                                        "post": {
+                                            "summary": "Invoice Notification",
+                                            "operationId": "invoice_notification__callback_url__invoices___request_body_id__post",
+                                            "requestBody": {
+                                                "required": True,
                                                 "content": {
                                                     "application/json": {
                                                         "schema": {
-                                                            "$ref": "#/components/schemas/InvoiceEventReceived"
+                                                            "$ref": "#/components/schemas/InvoiceEvent"
                                                         }
                                                     }
                                                 },
                                             },
-                                            "422": {
-                                                "description": "Validation Error",
-                                                "content": {
-                                                    "application/json": {
-                                                        "schema": {
-                                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                            "responses": {
+                                                "200": {
+                                                    "description": "Successful Response",
+                                                    "content": {
+                                                        "application/json": {
+                                                            "schema": {
+                                                                "$ref": "#/components/schemas/InvoiceEventReceived"
+                                                            }
                                                         }
-                                                    }
+                                                    },
+                                                },
+                                                "422": {
+                                                    "description": "Validation Error",
+                                                    "content": {
+                                                        "application/json": {
+                                                            "schema": {
+                                                                "$ref": "#/components/schemas/HTTPValidationError"
+                                                            }
+                                                        }
+                                                    },
                                                 },
                                             },
-                                        },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        },
+                        }
                     }
-                }
-            },
-            "components": {
-                "schemas": {
-                    "Event": {
-                        "title": "Event",
-                        "required": ["name", "total"],
-                        "type": "object",
-                        "properties": {
-                            "name": {"title": "Name", "type": "string"},
-                            "total": {"title": "Total", "type": "number"},
+                },
+                "components": {
+                    "schemas": {
+                        "Event": {
+                            "title": "Event",
+                            "required": ["name", "total"],
+                            "type": "object",
+                            "properties": {
+                                "name": {"title": "Name", "type": "string"},
+                                "total": {"title": "Total", "type": "number"},
+                            },
+                        },
+                        "HTTPValidationError": {
+                            "title": "HTTPValidationError",
+                            "type": "object",
+                            "properties": {
+                                "detail": {
+                                    "title": "Detail",
+                                    "type": "array",
+                                    "items": {
+                                        "$ref": "#/components/schemas/ValidationError"
+                                    },
+                                }
+                            },
                         },
-                    },
-                    "HTTPValidationError": {
-                        "title": "HTTPValidationError",
-                        "type": "object",
-                        "properties": {
-                            "detail": {
-                                "title": "Detail",
-                                "type": "array",
-                                "items": {
-                                    "$ref": "#/components/schemas/ValidationError"
+                        "Invoice": {
+                            "title": "Invoice",
+                            "required": ["id", "customer", "total"],
+                            "type": "object",
+                            "properties": {
+                                "id": {"title": "Id", "type": "string"},
+                                "title": {
+                                    "title": "Title",
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
                                 },
-                            }
+                                "customer": {"title": "Customer", "type": "string"},
+                                "total": {"title": "Total", "type": "number"},
+                            },
                         },
-                    },
-                    "Invoice": {
-                        "title": "Invoice",
-                        "required": ["id", "customer", "total"],
-                        "type": "object",
-                        "properties": {
-                            "id": {"title": "Id", "type": "string"},
-                            "title": {
-                                "title": "Title",
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                        "InvoiceEvent": {
+                            "title": "InvoiceEvent",
+                            "required": ["description", "paid"],
+                            "type": "object",
+                            "properties": {
+                                "description": {
+                                    "title": "Description",
+                                    "type": "string",
+                                },
+                                "paid": {"title": "Paid", "type": "boolean"},
                             },
-                            "customer": {"title": "Customer", "type": "string"},
-                            "total": {"title": "Total", "type": "number"},
                         },
-                    },
-                    "InvoiceEvent": {
-                        "title": "InvoiceEvent",
-                        "required": ["description", "paid"],
-                        "type": "object",
-                        "properties": {
-                            "description": {"title": "Description", "type": "string"},
-                            "paid": {"title": "Paid", "type": "boolean"},
+                        "InvoiceEventReceived": {
+                            "title": "InvoiceEventReceived",
+                            "required": ["ok"],
+                            "type": "object",
+                            "properties": {"ok": {"title": "Ok", "type": "boolean"}},
                         },
-                    },
-                    "InvoiceEventReceived": {
-                        "title": "InvoiceEventReceived",
-                        "required": ["ok"],
-                        "type": "object",
-                        "properties": {"ok": {"title": "Ok", "type": "boolean"}},
-                    },
-                    "ValidationError": {
-                        "title": "ValidationError",
-                        "required": ["loc", "msg", "type"],
-                        "type": "object",
-                        "properties": {
-                            "ctx": {"title": "Context", "type": "object"},
-                            "input": {"title": "Input"},
-                            "loc": {
-                                "title": "Location",
-                                "type": "array",
-                                "items": {
-                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                        "ValidationError": {
+                            "title": "ValidationError",
+                            "required": ["loc", "msg", "type"],
+                            "type": "object",
+                            "properties": {
+                                "ctx": {"title": "Context", "type": "object"},
+                                "input": {"title": "Input"},
+                                "loc": {
+                                    "title": "Location",
+                                    "type": "array",
+                                    "items": {
+                                        "anyOf": [
+                                            {"type": "string"},
+                                            {"type": "integer"},
+                                        ]
+                                    },
                                 },
+                                "msg": {"title": "Message", "type": "string"},
+                                "type": {"title": "Error Type", "type": "string"},
                             },
-                            "msg": {"title": "Message", "type": "string"},
-                            "type": {"title": "Error Type", "type": "string"},
                         },
-                    },
-                }
-            },
-        }
+                    }
+                },
+            }
+        )
index de9487df2a22639fc690d9f701d4fb3b27ccddb8..265388587b53f59fe89015a9704763c07bcd9a52 100644 (file)
@@ -1,5 +1,6 @@
 from fastapi import FastAPI, Form
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -83,189 +84,193 @@ def test_tuple_form_invalid():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/model-with-tuple/": {
-                "post": {
-                    "summary": "Post Model With Tuple",
-                    "operationId": "post_model_with_tuple_model_with_tuple__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/ItemGroup"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/model-with-tuple/": {
+                    "post": {
+                        "summary": "Post Model With Tuple",
+                        "operationId": "post_model_with_tuple_model_with_tuple__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/ItemGroup"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/tuple-of-models/": {
-                "post": {
-                    "summary": "Post Tuple Of Models",
-                    "operationId": "post_tuple_of_models_tuple_of_models__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Square",
-                                    "maxItems": 2,
-                                    "minItems": 2,
-                                    "type": "array",
-                                    "prefixItems": [
-                                        {"$ref": "#/components/schemas/Coordinate"},
-                                        {"$ref": "#/components/schemas/Coordinate"},
-                                    ],
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/tuple-of-models/": {
+                    "post": {
+                        "summary": "Post Tuple Of Models",
+                        "operationId": "post_tuple_of_models_tuple_of_models__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Square",
+                                        "maxItems": 2,
+                                        "minItems": 2,
+                                        "type": "array",
+                                        "prefixItems": [
+                                            {"$ref": "#/components/schemas/Coordinate"},
+                                            {"$ref": "#/components/schemas/Coordinate"},
+                                        ],
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/tuple-form/": {
-                "post": {
-                    "summary": "Hello",
-                    "operationId": "hello_tuple_form__post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_hello_tuple_form__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/tuple-form/": {
+                    "post": {
+                        "summary": "Hello",
+                        "operationId": "hello_tuple_form__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_hello_tuple_form__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_hello_tuple_form__post": {
-                    "title": "Body_hello_tuple_form__post",
-                    "required": ["values"],
-                    "type": "object",
-                    "properties": {
-                        "values": {
-                            "title": "Values",
-                            "maxItems": 2,
-                            "minItems": 2,
-                            "type": "array",
-                            "prefixItems": [
-                                {"type": "integer"},
-                                {"type": "integer"},
-                            ],
-                        }
-                    },
-                },
-                "Coordinate": {
-                    "title": "Coordinate",
-                    "required": ["x", "y"],
-                    "type": "object",
-                    "properties": {
-                        "x": {"title": "X", "type": "number"},
-                        "y": {"title": "Y", "type": "number"},
-                    },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
                 },
-                "ItemGroup": {
-                    "title": "ItemGroup",
-                    "required": ["items"],
-                    "type": "object",
-                    "properties": {
-                        "items": {
-                            "title": "Items",
-                            "type": "array",
-                            "items": {
+            },
+            "components": {
+                "schemas": {
+                    "Body_hello_tuple_form__post": {
+                        "title": "Body_hello_tuple_form__post",
+                        "required": ["values"],
+                        "type": "object",
+                        "properties": {
+                            "values": {
+                                "title": "Values",
                                 "maxItems": 2,
                                 "minItems": 2,
                                 "type": "array",
                                 "prefixItems": [
-                                    {"type": "string"},
-                                    {"type": "string"},
+                                    {"type": "integer"},
+                                    {"type": "integer"},
                                 ],
-                            },
-                        }
+                            }
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
+                    "Coordinate": {
+                        "title": "Coordinate",
+                        "required": ["x", "y"],
+                        "type": "object",
+                        "properties": {
+                            "x": {"title": "X", "type": "number"},
+                            "y": {"title": "Y", "type": "number"},
+                        },
+                    },
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
+                    },
+                    "ItemGroup": {
+                        "title": "ItemGroup",
+                        "required": ["items"],
+                        "type": "object",
+                        "properties": {
                             "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                "title": "Items",
+                                "type": "array",
+                                "items": {
+                                    "maxItems": 2,
+                                    "minItems": 2,
+                                    "type": "array",
+                                    "prefixItems": [
+                                        {"type": "string"},
+                                        {"type": "string"},
+                                    ],
+                                },
+                            }
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 78ccb84426f87f62f8c60c222894fc50d42c1aa5..d8d9d4130b3e229804e828bd0097ba7845a25037 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.additional_responses.tutorial001_py39 import app
 
@@ -20,99 +21,107 @@ def test_path_operation_not_found():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "404": {
-                            "description": "Not Found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Message"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "404": {
+                                "description": "Not Found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/Message"
+                                        }
+                                    }
+                                },
                             },
-                        },
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["id", "value"],
-                    "type": "object",
-                    "properties": {
-                        "id": {"title": "Id", "type": "string"},
-                        "value": {"title": "Value", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["id", "value"],
+                        "type": "object",
+                        "properties": {
+                            "id": {"title": "Id", "type": "string"},
+                            "value": {"title": "Value", "type": "string"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["message"],
+                        "type": "object",
+                        "properties": {
+                            "message": {"title": "Message", "type": "string"}
+                        },
                     },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["message"],
-                    "type": "object",
-                    "properties": {"message": {"title": "Message", "type": "string"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index cdab56d7a6e600acb8c30557ab24662c618ee8d0..4fae59d22295ff868cd48397884031f22f6478be 100644 (file)
@@ -4,6 +4,7 @@ import shutil
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from tests.utils import needs_py310
 
@@ -41,95 +42,99 @@ def test_path_operation_img(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Return the JSON item or an image.",
-                            "content": {
-                                "image/png": {},
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Return the JSON item or an image.",
+                                "content": {
+                                    "image/png": {},
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    },
                                 },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "boolean"}, {"type": "null"}],
-                                "title": "Img",
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "img",
-                            "in": "query",
-                        },
-                    ],
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "boolean"}, {"type": "null"}],
+                                    "title": "Img",
+                                },
+                                "name": "img",
+                                "in": "query",
+                            },
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["id", "value"],
-                    "type": "object",
-                    "properties": {
-                        "id": {"title": "Id", "type": "string"},
-                        "value": {"title": "Value", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["id", "value"],
+                        "type": "object",
+                        "properties": {
+                            "id": {"title": "Id", "type": "string"},
+                            "value": {"title": "Value", "type": "string"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fda786b3987b43312a874baf55fec5a502e17261..e888819dfe677f206327bfb8d6f54d78d3a796a4 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.additional_responses.tutorial003_py39 import app
 
@@ -20,103 +21,111 @@ def test_path_operation_not_found():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "404": {
-                            "description": "The item was not found",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Message"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "404": {
+                                "description": "The item was not found",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/Message"
+                                        }
+                                    }
+                                },
                             },
-                        },
-                        "200": {
-                            "description": "Item requested by ID",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"},
-                                    "example": {
-                                        "id": "bar",
-                                        "value": "The bar tenders",
-                                    },
-                                }
+                            "200": {
+                                "description": "Item requested by ID",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"},
+                                        "example": {
+                                            "id": "bar",
+                                            "value": "The bar tenders",
+                                        },
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["id", "value"],
-                    "type": "object",
-                    "properties": {
-                        "id": {"title": "Id", "type": "string"},
-                        "value": {"title": "Value", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["id", "value"],
+                        "type": "object",
+                        "properties": {
+                            "id": {"title": "Id", "type": "string"},
+                            "value": {"title": "Value", "type": "string"},
+                        },
+                    },
+                    "Message": {
+                        "title": "Message",
+                        "required": ["message"],
+                        "type": "object",
+                        "properties": {
+                            "message": {"title": "Message", "type": "string"}
+                        },
                     },
-                },
-                "Message": {
-                    "title": "Message",
-                    "required": ["message"],
-                    "type": "object",
-                    "properties": {"message": {"title": "Message", "type": "string"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f36d3d79c25d1fc0569c764717ac954a9c4bb671..9df326a5ced77b5789facb6bc3cccd9e2c9ef1a9 100644 (file)
@@ -4,6 +4,7 @@ import shutil
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from tests.utils import needs_py310
 
@@ -41,98 +42,102 @@ def test_path_operation_img(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "404": {"description": "Item not found"},
-                        "302": {"description": "The item was moved"},
-                        "403": {"description": "Not enough privileges"},
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "image/png": {},
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "404": {"description": "Item not found"},
+                            "302": {"description": "The item was moved"},
+                            "403": {"description": "Not enough privileges"},
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "image/png": {},
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    },
                                 },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "boolean"}, {"type": "null"}],
-                                "title": "Img",
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "img",
-                            "in": "query",
-                        },
-                    ],
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "boolean"}, {"type": "null"}],
+                                    "title": "Img",
+                                },
+                                "name": "img",
+                                "in": "query",
+                            },
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["id", "value"],
-                    "type": "object",
-                    "properties": {
-                        "id": {"title": "Id", "type": "string"},
-                        "value": {"title": "Value", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["id", "value"],
+                        "type": "object",
+                        "properties": {
+                            "id": {"title": "Id", "type": "string"},
+                            "value": {"title": "Value", "type": "string"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 00574b5b0fbf02e0cf492107f1e377882c3d2194..31adaa56a62c9881650cc7b2fdd5d564b781ea0b 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.behind_a_proxy.tutorial001_py39 import app
 
@@ -14,22 +15,24 @@ def test_main():
 def test_openapi():
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/app": {
-                "get": {
-                    "summary": "Read Main",
-                    "operationId": "read_main_app_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/app": {
+                    "get": {
+                        "summary": "Read Main",
+                        "operationId": "read_main_app_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-        "servers": [{"url": "/api/v1"}],
-    }
+            },
+            "servers": [{"url": "/api/v1"}],
+        }
+    )
index 1a49c0dfebd78147da3f194283e48d863dad800e..56e6f2f9d269b56d92755c62a65e8d88d0f85013 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.behind_a_proxy.tutorial002_py39 import app
 
@@ -14,22 +15,24 @@ def test_main():
 def test_openapi():
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/app": {
-                "get": {
-                    "summary": "Read Main",
-                    "operationId": "read_main_app_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/app": {
+                    "get": {
+                        "summary": "Read Main",
+                        "operationId": "read_main_app_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-        "servers": [{"url": "/api/v1"}],
-    }
+            },
+            "servers": [{"url": "/api/v1"}],
+        }
+    )
index f80563d142b3d21760b1c91f90f0700fc1e0f3b0..18845e4702098852475c549d4fc4ac4266af2565 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -269,334 +270,338 @@ def test_admin_invalid_header(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/": {
-                "get": {
-                    "tags": ["users"],
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/": {
+                    "get": {
+                        "tags": ["users"],
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/users/me": {
-                "get": {
-                    "tags": ["users"],
-                    "summary": "Read User Me",
-                    "operationId": "read_user_me_users_me_get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/users/me": {
+                    "get": {
+                        "tags": ["users"],
+                        "summary": "Read User Me",
+                        "operationId": "read_user_me_users_me_get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/users/{username}": {
-                "get": {
-                    "tags": ["users"],
-                    "summary": "Read User",
-                    "operationId": "read_user_users__username__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Username", "type": "string"},
-                            "name": "username",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/users/{username}": {
+                    "get": {
+                        "tags": ["users"],
+                        "summary": "Read User",
+                        "operationId": "read_user_users__username__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Username", "type": "string"},
+                                "name": "username",
+                                "in": "path",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/items/": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/items/": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "404": {"description": "Not found"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "404": {"description": "Not found"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/items/{item_id}": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "404": {"description": "Not found"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
                     },
-                }
-            },
-            "/items/{item_id}": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "404": {"description": "Not found"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    "put": {
+                        "tags": ["items", "custom"],
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "404": {"description": "Not found"},
+                            "403": {"description": "Operation forbidden"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
                     },
                 },
-                "put": {
-                    "tags": ["items", "custom"],
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "404": {"description": "Not found"},
-                        "403": {"description": "Operation forbidden"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                "/admin/": {
+                    "post": {
+                        "tags": ["admin"],
+                        "summary": "Update Admin",
+                        "operationId": "update_admin_admin__post",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "418": {"description": "I'm a teapot"},
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
+                    }
                 },
-            },
-            "/admin/": {
-                "post": {
-                    "tags": ["admin"],
-                    "summary": "Update Admin",
-                    "operationId": "update_admin_admin__post",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "418": {"description": "I'm a teapot"},
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                "/": {
+                    "get": {
+                        "summary": "Root",
+                        "operationId": "root__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Token", "type": "string"},
+                                "name": "token",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
+                    }
+                },
             },
-            "/": {
-                "get": {
-                    "summary": "Root",
-                    "operationId": "root__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Token", "type": "string"},
-                            "name": "token",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
-                                }
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
                     },
                 }
             },
-        },
-        "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"}]
-                            },
-                        },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
-                    },
-                },
-            }
-        },
-    }
+        }
+    )
index 9a837483f2a55a7a3684e2a62caf3d7ff528cc08..c1877a72ef5b9f8b8cea4987532166c9163f8b0e 100644 (file)
@@ -3,6 +3,7 @@ from unittest.mock import patch
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -260,89 +261,93 @@ def test_other_exceptions(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index e8b23e8f6115733c7f7913f28ad4d2055aaa6235..94bf213e3fd6bd0952c06d9eb45d564705a474f9 100644 (file)
@@ -3,6 +3,7 @@ from typing import Union
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -75,89 +76,93 @@ def test_post_with_no_data(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 7b8b7ea89f2cddb176eb73eddbae37b0d648ec4a..832c211f6694a84032bc609eed3a905e72994377 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -74,100 +75,104 @@ def test_put_with_no_data(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index d78c760f5de4f686c4eda112ccd3c5747d6712d2..1019a168cff965eb707b38fd816b20f3777b0122 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -76,109 +77,113 @@ def test_put_with_no_data(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
                             },
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index cb6da290852807818bcf891a469f4ca099980590..0116dcb09c9db76461a5661b63404f4f5a5aa7c3 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -74,113 +75,117 @@ def test_invalid_price(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_update_item_items__item_id__put"
                                     }
                                 }
                             },
-                        },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_update_item_items__item_id__put"
-                                }
-                            }
                         },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "The description of the item",
-                            "anyOf": [
-                                {"maxLength": 300, "type": "string"},
-                                {"type": "null"},
-                            ],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "exclusiveMinimum": 0.0,
-                            "type": "number",
-                            "description": "The price must be greater than zero",
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "The description of the item",
+                                "anyOf": [
+                                    {"maxLength": 300, "type": "string"},
+                                    {"type": "null"},
+                                ],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "exclusiveMinimum": 0.0,
+                                "type": "number",
+                                "description": "The price must be greater than zero",
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "Body_update_item_items__item_id__put": {
-                    "title": "Body_update_item_items__item_id__put",
-                    "required": ["item"],
-                    "type": "object",
-                    "properties": {"item": {"$ref": "#/components/schemas/Item"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "Body_update_item_items__item_id__put": {
+                        "title": "Body_update_item_items__item_id__put",
+                        "required": ["item"],
+                        "type": "object",
+                        "properties": {"item": {"$ref": "#/components/schemas/Item"}},
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index a4f24627b0cf494e27ed38b6b86d3599b933e399..2e8ba457bed1018f61ec941840ceb624bf90c8df 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -67,116 +68,120 @@ def test_post_id_foo(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "The ID of the item to get",
+                                    "maximum": 1000.0,
+                                    "minimum": 0.0,
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
+                            },
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            },
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "anyOf": [
+                                            {"$ref": "#/components/schemas/Item"},
+                                            {"type": "null"},
+                                        ],
+                                        "title": "Item",
                                     }
                                 }
-                            },
-                        },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "The ID of the item to get",
-                                "maximum": 1000.0,
-                                "minimum": 0.0,
-                                "type": "integer",
-                            },
-                            "name": "item_id",
-                            "in": "path",
+                            }
                         },
-                        {
-                            "required": False,
-                            "schema": {
+                    }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
                                 "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "anyOf": [
-                                        {"$ref": "#/components/schemas/Item"},
-                                        {"type": "null"},
-                                    ],
-                                    "title": "Item",
-                                }
-                            }
-                        }
-                    },
-                }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 155bda0c9928533c874d021d464549beee5d3292..0c94e9dd1ebc7a9793757d6aeff295ec46bdac77 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -197,167 +198,169 @@ def test_post_id_foo(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
-                            },
-                        },
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
+    assert response.json() == snapshot(
+        {
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
                                 "schema": {
-                                    "$ref": "#/components/schemas/Body_update_item_items__item_id__put",
+                                    "title": "Item Id",
+                                    "type": "integer",
                                 },
                             },
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {},
+                                    "schema": {
+                                        "$ref": "#/components/schemas/Body_update_item_items__item_id__put",
+                                    },
                                 },
                             },
-                            "description": "Successful Response",
+                            "required": True,
                         },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
+                                },
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Update Item",
                     },
-                    "summary": "Update Item",
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_update_item_items__item_id__put": {
-                    "properties": {
-                        "item": {
-                            "$ref": "#/components/schemas/Item",
-                        },
-                        "user": {
-                            "$ref": "#/components/schemas/User",
+            "components": {
+                "schemas": {
+                    "Body_update_item_items__item_id__put": {
+                        "properties": {
+                            "item": {
+                                "$ref": "#/components/schemas/Item",
+                            },
+                            "user": {
+                                "$ref": "#/components/schemas/User",
+                            },
                         },
+                        "required": [
+                            "item",
+                            "user",
+                        ],
+                        "title": "Body_update_item_items__item_id__put",
+                        "type": "object",
                     },
-                    "required": [
-                        "item",
-                        "user",
-                    ],
-                    "title": "Body_update_item_items__item_id__put",
-                    "type": "object",
-                },
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "User": {
-                    "properties": {
-                        "username": {
-                            "title": "Username",
-                            "type": "string",
-                        },
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "User": {
+                        "properties": {
+                            "username": {
+                                "title": "Username",
+                                "type": "string",
+                            },
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
+                        "required": [
+                            "username",
+                        ],
+                        "title": "User",
+                        "type": "object",
                     },
-                    "required": [
-                        "username",
-                    ],
-                    "title": "User",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 2f403797fe009482acb247580be1b8a554a8ce50..c27f3d5ba8fafe9ffd16df81e161c711b1db8555 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -102,121 +103,125 @@ def test_post_body_empty_list(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_update_item_items__item_id__put"
                                     }
                                 }
                             },
-                        },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_update_item_items__item_id__put"
-                                }
-                            }
                         },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "User": {
-                    "title": "User",
-                    "required": ["username"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "User": {
+                        "title": "User",
+                        "required": ["username"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "Body_update_item_items__item_id__put": {
-                    "title": "Body_update_item_items__item_id__put",
-                    "required": ["item", "user", "importance"],
-                    "type": "object",
-                    "properties": {
-                        "item": {"$ref": "#/components/schemas/Item"},
-                        "user": {"$ref": "#/components/schemas/User"},
-                        "importance": {"title": "Importance", "type": "integer"},
+                    "Body_update_item_items__item_id__put": {
+                        "title": "Body_update_item_items__item_id__put",
+                        "required": ["item", "user", "importance"],
+                        "type": "object",
+                        "properties": {
+                            "item": {"$ref": "#/components/schemas/Item"},
+                            "user": {"$ref": "#/components/schemas/User"},
+                            "importance": {"title": "Importance", "type": "integer"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 506e55eebcabb5d6827f768dbe8296aa11bae853..2a39f3d7136e326be1781c91f5468d0d502cbbf3 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -159,134 +160,138 @@ def test_put_invalid_importance(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            },
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            },
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_update_item_items__item_id__put"
                                     }
                                 }
                             },
-                        },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
                         },
-                        {
-                            "required": False,
-                            "schema": {
+                    }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
                                 "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_update_item_items__item_id__put"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "User": {
-                    "title": "User",
-                    "required": ["username"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "User": {
+                        "title": "User",
+                        "required": ["username"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "Body_update_item_items__item_id__put": {
-                    "title": "Body_update_item_items__item_id__put",
-                    "required": ["item", "user", "importance"],
-                    "type": "object",
-                    "properties": {
-                        "item": {"$ref": "#/components/schemas/Item"},
-                        "user": {"$ref": "#/components/schemas/User"},
-                        "importance": {
-                            "title": "Importance",
-                            "type": "integer",
-                            "exclusiveMinimum": 0.0,
+                    "Body_update_item_items__item_id__put": {
+                        "title": "Body_update_item_items__item_id__put",
+                        "required": ["item", "user", "importance"],
+                        "type": "object",
+                        "properties": {
+                            "item": {"$ref": "#/components/schemas/Item"},
+                            "user": {"$ref": "#/components/schemas/User"},
+                            "importance": {
+                                "title": "Importance",
+                                "type": "integer",
+                                "exclusiveMinimum": 0.0,
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 20859d12c8b1e9b7f667665bc4f0e10f94b831ab..d600e0767ddef5ac1ade772aa3035137361430b6 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -131,144 +132,146 @@ def test_post_missing_required_field_in_item(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
-                            },
-                        },
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
+    assert response.json() == snapshot(
+        {
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
                                 "schema": {
-                                    "$ref": "#/components/schemas/Body_update_item_items__item_id__put",
+                                    "title": "Item Id",
+                                    "type": "integer",
                                 },
                             },
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {},
+                                    "schema": {
+                                        "$ref": "#/components/schemas/Body_update_item_items__item_id__put",
+                                    },
                                 },
                             },
-                            "description": "Successful Response",
+                            "required": True,
                         },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
                                     },
                                 },
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
+                                    },
+                                },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Update Item",
                     },
-                    "summary": "Update Item",
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_update_item_items__item_id__put": {
-                    "properties": {
-                        "item": {
-                            "$ref": "#/components/schemas/Item",
+            "components": {
+                "schemas": {
+                    "Body_update_item_items__item_id__put": {
+                        "properties": {
+                            "item": {
+                                "$ref": "#/components/schemas/Item",
+                            },
                         },
+                        "required": ["item"],
+                        "title": "Body_update_item_items__item_id__put",
+                        "type": "object",
                     },
-                    "required": ["item"],
-                    "title": "Body_update_item_items__item_id__put",
-                    "type": "object",
-                },
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index ae494350b31bf01ab149eda12b1ae866458c527a..78e5e53a20f9244148596efa0415d81458945166 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -142,112 +143,116 @@ def test_openapi_schema(client: TestClient, mod_name: str):
 
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Item",
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": tags_schema,
                         },
-                        "tags": tags_schema,
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c1410330c41a5fdc93d717f9517a9a91aa6ce781..6a70779b6834d607662c9045b984254b4b3be0e6 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -139,139 +140,143 @@ def test_put_missing_required_in_image(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Item",
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Image": {
-                    "properties": {
-                        "url": {
-                            "title": "Url",
-                            "type": "string",
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
+            },
+            "components": {
+                "schemas": {
+                    "Image": {
+                        "properties": {
+                            "url": {
+                                "title": "Url",
+                                "type": "string",
+                            },
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
                         },
+                        "required": ["url", "name"],
+                        "title": "Image",
+                        "type": "object",
                     },
-                    "required": ["url", "name"],
-                    "title": "Image",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "default": [],
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "uniqueItems": True,
-                        },
-                        "image": {
-                            "anyOf": [
-                                {"$ref": "#/components/schemas/Image"},
-                                {"type": "null"},
-                            ],
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "default": [],
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "uniqueItems": True,
+                            },
+                            "image": {
+                                "anyOf": [
+                                    {"$ref": "#/components/schemas/Image"},
+                                    {"type": "null"},
+                                ],
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c09e0c1b10f8129668a321a4aee197d381184ee3..2ff3d4f220fc3aa7d6270d30a84f5a7f84076382 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -162,142 +163,146 @@ def test_put_wrong_url(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Item",
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Image": {
-                    "properties": {
-                        "url": {
-                            "title": "Url",
-                            "type": "string",
-                            "format": "uri",
-                            "maxLength": 2083,
-                            "minLength": 1,
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
+            },
+            "components": {
+                "schemas": {
+                    "Image": {
+                        "properties": {
+                            "url": {
+                                "title": "Url",
+                                "type": "string",
+                                "format": "uri",
+                                "maxLength": 2083,
+                                "minLength": 1,
+                            },
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
                         },
+                        "required": ["url", "name"],
+                        "title": "Image",
+                        "type": "object",
                     },
-                    "required": ["url", "name"],
-                    "title": "Image",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "default": [],
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "uniqueItems": True,
-                        },
-                        "image": {
-                            "anyOf": [
-                                {"$ref": "#/components/schemas/Image"},
-                                {"type": "null"},
-                            ],
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "default": [],
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "uniqueItems": True,
+                            },
+                            "image": {
+                                "anyOf": [
+                                    {"$ref": "#/components/schemas/Image"},
+                                    {"type": "null"},
+                                ],
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f26c50167b875ce6244fafbe83d13d123abe84ba..229216fc58b996653dcb0676c9596388410a7ed5 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -122,150 +123,154 @@ def test_put_images_not_list(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Item",
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Image": {
-                    "properties": {
-                        "url": {
-                            "title": "Url",
-                            "type": "string",
-                            "format": "uri",
-                            "maxLength": 2083,
-                            "minLength": 1,
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
+            },
+            "components": {
+                "schemas": {
+                    "Image": {
+                        "properties": {
+                            "url": {
+                                "title": "Url",
+                                "type": "string",
+                                "format": "uri",
+                                "maxLength": 2083,
+                                "minLength": 1,
+                            },
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
                         },
+                        "required": ["url", "name"],
+                        "title": "Image",
+                        "type": "object",
                     },
-                    "required": ["url", "name"],
-                    "title": "Image",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "default": [],
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "uniqueItems": True,
-                        },
-                        "images": {
-                            "anyOf": [
-                                {
-                                    "items": {
-                                        "$ref": "#/components/schemas/Image",
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "default": [],
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "uniqueItems": True,
+                            },
+                            "images": {
+                                "anyOf": [
+                                    {
+                                        "items": {
+                                            "$ref": "#/components/schemas/Image",
+                                        },
+                                        "type": "array",
                                     },
-                                    "type": "array",
-                                },
-                                {
-                                    "type": "null",
-                                },
-                            ],
-                            "title": "Images",
+                                    {
+                                        "type": "null",
+                                    },
+                                ],
+                                "title": "Images",
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index dac168e242b8a87d31260324bcf2db8e3f98ea31..5a7763f598ff27d3086f77ad2537d1d2a6b3e316 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -184,163 +185,167 @@ def test_put_missing_required_in_images(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/offers/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/offers/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Offer",
+                        "operationId": "create_offer_offers__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Offer",
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Offer",
-                    "operationId": "create_offer_offers__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Offer",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Image": {
-                    "properties": {
-                        "url": {
-                            "title": "Url",
-                            "type": "string",
-                            "format": "uri",
-                            "maxLength": 2083,
-                            "minLength": 1,
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
+            },
+            "components": {
+                "schemas": {
+                    "Image": {
+                        "properties": {
+                            "url": {
+                                "title": "Url",
+                                "type": "string",
+                                "format": "uri",
+                                "maxLength": 2083,
+                                "minLength": 1,
+                            },
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
                         },
+                        "required": ["url", "name"],
+                        "title": "Image",
+                        "type": "object",
                     },
-                    "required": ["url", "name"],
-                    "title": "Image",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "default": [],
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "uniqueItems": True,
-                        },
-                        "images": {
-                            "anyOf": [
-                                {
-                                    "items": {
-                                        "$ref": "#/components/schemas/Image",
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "default": [],
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "uniqueItems": True,
+                            },
+                            "images": {
+                                "anyOf": [
+                                    {
+                                        "items": {
+                                            "$ref": "#/components/schemas/Image",
+                                        },
+                                        "type": "array",
                                     },
-                                    "type": "array",
-                                },
-                                {
-                                    "type": "null",
-                                },
-                            ],
-                            "title": "Images",
+                                    {
+                                        "type": "null",
+                                    },
+                                ],
+                                "title": "Images",
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "Offer": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "items": {
-                            "title": "Items",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Item"},
+                    "Offer": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "items": {
+                                "title": "Items",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Item"},
+                            },
                         },
+                        "required": ["name", "price", "items"],
+                        "title": "Offer",
+                        "type": "object",
                     },
-                    "required": ["name", "price", "items"],
-                    "title": "Offer",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 2101b7bbe57eedc642fcf480b4d48d8e4eb3854f..26f48f1d5fb0cacb7833a0b2313d9a4e75a8e8b3 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -66,94 +67,98 @@ def test_post_not_a_list(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/images/multiple/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/images/multiple/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Multiple Images",
+                        "operationId": "create_multiple_images_images_multiple__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Images",
+                                        "type": "array",
+                                        "items": {"$ref": "#/components/schemas/Image"},
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Multiple Images",
-                    "operationId": "create_multiple_images_images_multiple__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Images",
-                                    "type": "array",
-                                    "items": {"$ref": "#/components/schemas/Image"},
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Image": {
-                    "properties": {
-                        "url": {
-                            "title": "Url",
-                            "type": "string",
-                            "format": "uri",
-                            "maxLength": 2083,
-                            "minLength": 1,
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
+            },
+            "components": {
+                "schemas": {
+                    "Image": {
+                        "properties": {
+                            "url": {
+                                "title": "Url",
+                                "type": "string",
+                                "format": "uri",
+                                "maxLength": 2083,
+                                "minLength": 1,
+                            },
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
                         },
+                        "required": ["url", "name"],
+                        "title": "Image",
+                        "type": "object",
                     },
-                    "required": ["url", "name"],
-                    "title": "Image",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f7481a5f7f4ade17c8f9e849320a6bf8a78fabaf..492dcecd2b603b1faba51fea7d5f5a5278cb7aee 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -43,76 +44,80 @@ def test_post_invalid_body(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/index-weights/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/index-weights/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Index Weights",
+                        "operationId": "create_index_weights_index_weights__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Weights",
+                                        "type": "object",
+                                        "additionalProperties": {"type": "number"},
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Index Weights",
-                    "operationId": "create_index_weights_index_weights__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Weights",
-                                    "type": "object",
-                                    "additionalProperties": {"type": "number"},
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 9c6a90576c64f28a979560ea055f01a083adc7ee..feb07b85959818c18d37751c370a744f09d7c1c7 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -48,141 +49,145 @@ def test_put(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
                     },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                },
-                "put": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+                    "put": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
-                        },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
                         },
-                        "required": True,
                     },
-                },
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "type": "object",
-                    "title": "Item",
-                    "properties": {
-                        "name": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Name",
-                        },
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
-                        },
-                        "price": {
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                            "title": "Price",
-                        },
-                        "tax": {"title": "Tax", "type": "number", "default": 10.5},
-                        "tags": {
-                            "title": "Tags",
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "default": [],
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "type": "object",
+                        "title": "Item",
+                        "properties": {
+                            "name": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Name",
+                            },
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
+                            "price": {
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                                "title": "Price",
+                            },
+                            "tax": {"title": "Tax", "type": "number", "default": 10.5},
+                            "tags": {
+                                "title": "Tags",
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "default": [],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 7d79cf5e63a5325a73b92d564d186b542efa2501..a34d08b52bce3c2e9681d4185beca09c7f61d2c2 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -69,141 +70,145 @@ def test_patch_name(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
                     },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                },
-                "patch": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+                    "patch": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__patch",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
-                        },
-                    },
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__patch",
-                    "parameters": [
-                        {
                             "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
                         },
-                        "required": True,
                     },
-                },
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "type": "object",
-                    "title": "Item",
-                    "properties": {
-                        "name": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Name",
-                        },
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
-                        },
-                        "price": {
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                            "title": "Price",
-                        },
-                        "tax": {"title": "Tax", "type": "number", "default": 10.5},
-                        "tags": {
-                            "title": "Tags",
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "default": [],
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "type": "object",
+                        "title": "Item",
+                        "properties": {
+                            "name": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Name",
+                            },
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
+                            "price": {
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                                "title": "Price",
+                            },
+                            "tax": {"title": "Tax", "type": "number", "default": 10.5},
+                            "tags": {
+                                "title": "Tags",
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "default": [],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index ddc282d85e5f24ee15b631e4bc07a788cad6a157..644b82ad9a9e04f79c8687a303d6c52cf2cd82f6 100644 (file)
@@ -1,6 +1,7 @@
 import importlib
 
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 def get_client() -> TestClient:
@@ -38,21 +39,23 @@ def test_default_openapi():
     response = client.get("/redoc")
     assert response.status_code == 200, response.text
     response = client.get("/openapi.json")
-    assert response.json() == {
-        "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": {}}},
-                        }
-                    },
+    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": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index ab7114876446befdc0c152cd1eca2c1fcc65c272..4d7adf0d608bc928016722188f6c8427d3329804 100644 (file)
@@ -3,6 +3,7 @@ from types import ModuleType
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -47,75 +48,79 @@ def test_openapi_schema(mod: ModuleType):
     client = TestClient(mod.app)
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Ads Id",
-                            },
-                            "name": "ads_id",
-                            "in": "cookie",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Ads Id",
+                                },
+                                "name": "ads_id",
+                                "in": "cookie",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f1d2accef27a43dc60f625eb9c62f186f08b2f23..20244bef450b4b27cce61f6600478019fae1b4ae 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -26,21 +27,23 @@ def test_get_custom_response(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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",
+    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",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 3337f47d5f7f6084568fb1f2538c0f591007dc24..746801df16ac138024d648a7909caa10e70cfc06 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.custom_response.tutorial001b_py39 import app
 
@@ -14,21 +15,23 @@ def test_get_custom_response():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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",
+    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",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 22e2e0254045443253ef0f47ee60df75c160f517..f79d38b831ff5546bf408d5373df79a9dd4bc180 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -48,21 +49,23 @@ def test_openapi_schema(client: TestClient, mod_name: str):
 
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": response_content,
-                        }
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": response_content,
+                            }
+                        },
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index fea105c28ee317eb52bae386d0fc756fc079c767..b4919af6c3372a4ecfd00fcc3a2e3eb3f682e00d 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.custom_response.tutorial005_py39 import app
 
@@ -14,21 +15,25 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "summary": "Main",
-                    "operationId": "main__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"text/plain": {"schema": {"type": "string"}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "summary": "Main",
+                        "operationId": "main__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "text/plain": {"schema": {"type": "string"}}
+                                },
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index e9e6ca1086b9d5caf51ddd06313ee7ad2c19b2f6..ea2d366aa06d0ff71b00220434fc071789ec242f 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.custom_response.tutorial006_py39 import app
 
@@ -14,21 +15,23 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/typer": {
-                "get": {
-                    "summary": "Redirect Typer",
-                    "operationId": "redirect_typer_typer_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/typer": {
+                    "get": {
+                        "summary": "Redirect Typer",
+                        "operationId": "redirect_typer_typer_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 7ca727d2cd74a90a58194e623085289c2ab7cbaa..133a591b16df21975444db99d22286ce1fb034df 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.custom_response.tutorial006b_py39 import app
 
@@ -14,16 +15,18 @@ def test_redirect_response_class():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/fastapi": {
-                "get": {
-                    "summary": "Redirect Fastapi",
-                    "operationId": "redirect_fastapi_fastapi_get",
-                    "responses": {"307": {"description": "Successful Response"}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/fastapi": {
+                    "get": {
+                        "summary": "Redirect Fastapi",
+                        "operationId": "redirect_fastapi_fastapi_get",
+                        "responses": {"307": {"description": "Successful Response"}},
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index e3f76c8403c2e704e1a7c02d0d031feb675e4919..5b17d815d0ce577490c49c7500b25ffc16208084 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.custom_response.tutorial006c_py39 import app
 
@@ -14,16 +15,18 @@ def test_redirect_status_code():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/pydantic": {
-                "get": {
-                    "summary": "Redirect Pydantic",
-                    "operationId": "redirect_pydantic_pydantic_get",
-                    "responses": {"302": {"description": "Successful Response"}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/pydantic": {
+                    "get": {
+                        "summary": "Redirect Pydantic",
+                        "operationId": "redirect_pydantic_pydantic_get",
+                        "responses": {"302": {"description": "Successful Response"}},
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 756eacf233777f42b270eefe54304131a4292eb9..a3d2cf515279f070f12b3a7f5b131a3a460f7256 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from tests.utils import needs_py310
 
@@ -50,89 +51,93 @@ def test_post_invalid_item(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
                         },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                    },
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index de63a947668881eb97909d96fc6248a0e9fec54e..e023271bc3b55f38d395282734141ef0250b9e92 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -70,135 +71,141 @@ def test_get_authors(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/authors/{author_id}/items/": {
-                "post": {
-                    "summary": "Create Author Items",
-                    "operationId": "create_author_items_authors__author_id__items__post",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Author Id", "type": "string"},
-                            "name": "author_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Items",
-                                    "type": "array",
-                                    "items": {"$ref": "#/components/schemas/Item"},
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/authors/{author_id}/items/": {
+                    "post": {
+                        "summary": "Create Author Items",
+                        "operationId": "create_author_items_authors__author_id__items__post",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Author Id", "type": "string"},
+                                "name": "author_id",
+                                "in": "path",
                             }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Author"}
-                                }
-                            },
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Items",
+                                        "type": "array",
+                                        "items": {"$ref": "#/components/schemas/Item"},
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/authors/": {
-                "get": {
-                    "summary": "Get Authors",
-                    "operationId": "get_authors_authors__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Get Authors Authors  Get",
-                                        "type": "array",
-                                        "items": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
                                             "$ref": "#/components/schemas/Author"
-                                        },
+                                        }
                                     }
-                                }
+                                },
                             },
-                        }
-                    },
-                }
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
+                "/authors/": {
+                    "get": {
+                        "summary": "Get Authors",
+                        "operationId": "get_authors_authors__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Get Authors Authors  Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Author"
+                                            },
+                                        }
+                                    }
+                                },
+                            }
+                        },
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Author": {
-                    "title": "Author",
-                    "required": ["name"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "items": {
-                            "title": "Items",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/Item"},
+            "components": {
+                "schemas": {
+                    "Author": {
+                        "title": "Author",
+                        "required": ["name"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "items": {
+                                "title": "Items",
+                                "type": "array",
+                                "items": {"$ref": "#/components/schemas/Item"},
+                            },
                         },
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index cf62c3b19439b4ea4c993dda11429cba94670e34..1a0ca6cad7b1ceb6e793f89d638d300aef439cb3 100644 (file)
@@ -5,6 +5,7 @@ import unittest
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 MOD_NAME = "docs_src.debugging.tutorial001_py39"
 
@@ -44,21 +45,23 @@ def test_uvicorn_run_called_when_run_as_main():  # Just for coverage
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "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": {}}},
+    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": {}}},
+                            },
                         },
-                    },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 15919c63f71c6696f1a121353ab3c498ac83ec4a..74f4a8f3a2f2159f2416ebb5baefbdf79e84741a 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -43,148 +44,152 @@ def test_get(path, expected_status, expected_response, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Skip",
-                                "type": "integer",
-                                "default": 0,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Skip",
+                                    "type": "integer",
+                                    "default": 0,
+                                },
+                                "name": "skip",
+                                "in": "query",
                             },
-                            "name": "skip",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Limit",
-                                "type": "integer",
-                                "default": 100,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Limit",
+                                    "type": "integer",
+                                    "default": 100,
+                                },
+                                "name": "limit",
+                                "in": "query",
                             },
-                            "name": "limit",
-                            "in": "query",
-                        },
-                    ],
-                }
-            },
-            "/users/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        ],
+                    }
+                },
+                "/users/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Skip",
-                                "type": "integer",
-                                "default": 0,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Skip",
+                                    "type": "integer",
+                                    "default": 0,
+                                },
+                                "name": "skip",
+                                "in": "query",
                             },
-                            "name": "skip",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Limit",
-                                "type": "integer",
-                                "default": 100,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Limit",
+                                    "type": "integer",
+                                    "default": 100,
+                                },
+                                "name": "limit",
+                                "in": "query",
                             },
-                            "name": "limit",
-                            "in": "query",
-                        },
-                    ],
-                }
+                        ],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 96300a25995a4e3e17196292fdbc1a5924610dc8..6e1cea5a0838ff58f4a65e36474dea0a9f43aa52 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -87,95 +88,99 @@ def test_get(path, expected_status, expected_response, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Skip",
-                                "type": "integer",
-                                "default": 0,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Skip",
+                                    "type": "integer",
+                                    "default": 0,
+                                },
+                                "name": "skip",
+                                "in": "query",
                             },
-                            "name": "skip",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Limit",
-                                "type": "integer",
-                                "default": 100,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Limit",
+                                    "type": "integer",
+                                    "default": 100,
+                                },
+                                "name": "limit",
+                                "in": "query",
                             },
-                            "name": "limit",
-                            "in": "query",
-                        },
-                    ],
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index e595859cb89a8e0becb14b47a11daf633f190fcf..31054744a1adc8130d299f95d02919404b902f03 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -58,84 +59,88 @@ def test_get(path, cookie, expected_status, expected_response, client: TestClien
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Query",
-                    "operationId": "read_query_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Q",
+                        "summary": "Read Query",
+                        "operationId": "read_query_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Last Query",
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Last Query",
+                                },
+                                "name": "last_query",
+                                "in": "cookie",
                             },
-                            "name": "last_query",
-                            "in": "cookie",
-                        },
-                    ],
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index cdea27b7c0db182db5c5a93fb24f3df8b5c99d57..8d6cfa2d651aae2ca67c77fd51a026f53f390d7e 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -68,78 +69,82 @@ def test_get_valid_headers(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Key", "type": "string"},
-                            "name": "x-key",
-                            "in": "header",
-                        },
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Key", "type": "string"},
+                                "name": "x-key",
+                                "in": "header",
+                            },
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 3374c54b5ebaf65422ee98562658bad40aa33aea..383422a7e62c35fcdc9e0435b1a276630ffc09b2 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -47,76 +48,80 @@ def test_get(path, expected_status, expected_response, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/query-checker/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/query-checker/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Query Check",
-                    "operationId": "read_query_check_query_checker__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "type": "string",
-                                "default": "",
-                                "title": "Q",
+                        "summary": "Read Query Check",
+                        "operationId": "read_query_check_query_checker__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "type": "string",
+                                    "default": "",
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f342ff842eccffd0ea48d1140dfab02e15356e87..a15688924572c366b886abec783ced72219e4247 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -115,114 +116,118 @@ def test_get_valid_headers_users(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Key", "type": "string"},
-                            "name": "x-key",
-                            "in": "header",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Key", "type": "string"},
+                                "name": "x-key",
+                                "in": "header",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                }
-            },
-            "/users/": {
-                "get": {
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Token", "type": "string"},
-                            "name": "x-token",
-                            "in": "header",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "X-Key", "type": "string"},
-                            "name": "x-key",
-                            "in": "header",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                    }
+                },
+                "/users/": {
+                    "get": {
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Token", "type": "string"},
+                                "name": "x-token",
+                                "in": "header",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "X-Key", "type": "string"},
+                                "name": "x-key",
+                                "in": "header",
+                            },
+                        ],
+                        "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"},
-                        }
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 5a4edbc66e771532a3d53db97843f33740f6aa1f..a3d67233366816201b486ad51b701883c37a1799 100644 (file)
@@ -3,6 +3,7 @@ from types import ModuleType
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -73,138 +74,140 @@ def test_put_invalid_data(client: TestClient, mod: ModuleType):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{id}": {
-                "put": {
-                    "operationId": "update_item_items__id__put",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "id",
-                            "required": True,
-                            "schema": {
-                                "title": "Id",
-                                "type": "string",
-                            },
-                        },
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{id}": {
+                    "put": {
+                        "operationId": "update_item_items__id__put",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "id",
+                                "required": True,
                                 "schema": {
-                                    "$ref": "#/components/schemas/Item",
+                                    "title": "Id",
+                                    "type": "string",
                                 },
                             },
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {},
+                                    "schema": {
+                                        "$ref": "#/components/schemas/Item",
+                                    },
                                 },
                             },
-                            "description": "Successful Response",
+                            "required": True,
                         },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
                                     },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Validation Error",
-                        },
-                    },
-                    "summary": "Update Item",
-                },
-            },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
+                                    },
+                                },
+                                "description": "Validation Error",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "summary": "Update Item",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
                 },
-                "Item": {
-                    "properties": {
-                        "description": {
-                            "anyOf": [
-                                {
-                                    "type": "string",
-                                },
-                                {
-                                    "type": "null",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
                                 },
-                            ],
-                            "title": "Description",
-                        },
-                        "timestamp": {
-                            "format": "date-time",
-                            "title": "Timestamp",
-                            "type": "string",
-                        },
-                        "title": {
-                            "title": "Title",
-                            "type": "string",
+                                "title": "Detail",
+                                "type": "array",
+                            },
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "title",
-                        "timestamp",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
+                    "Item": {
+                        "properties": {
+                            "description": {
                                 "anyOf": [
                                     {
                                         "type": "string",
                                     },
                                     {
-                                        "type": "integer",
+                                        "type": "null",
                                     },
                                 ],
+                                "title": "Description",
+                            },
+                            "timestamp": {
+                                "format": "date-time",
+                                "title": "Timestamp",
+                                "type": "string",
+                            },
+                            "title": {
+                                "title": "Title",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
                         },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
+                        "required": [
+                            "title",
+                            "timestamp",
+                        ],
+                        "title": "Item",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
+                            },
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 48b838d5a0a8d8d7fbdcd05fa701a930a5b60d5a..63215c00dbacf1ac48a7b4cfa7b0e1fa6262d197 100644 (file)
@@ -1,6 +1,7 @@
 import pytest
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(name="app", scope="module")
@@ -21,74 +22,79 @@ def test_openapi_schema(app: FastAPI):
     with TestClient(app) as client:
         response = client.get("/openapi.json")
         assert response.status_code == 200, response.text
-        assert response.json() == {
-            "openapi": "3.1.0",
-            "info": {"title": "FastAPI", "version": "0.1.0"},
-            "paths": {
-                "/items/{item_id}": {
-                    "get": {
-                        "responses": {
-                            "200": {
-                                "description": "Successful Response",
-                                "content": {"application/json": {"schema": {}}},
-                            },
-                            "422": {
-                                "description": "Validation Error",
-                                "content": {
-                                    "application/json": {
-                                        "schema": {
-                                            "$ref": "#/components/schemas/HTTPValidationError"
+        assert response.json() == snapshot(
+            {
+                "openapi": "3.1.0",
+                "info": {"title": "FastAPI", "version": "0.1.0"},
+                "paths": {
+                    "/items/{item_id}": {
+                        "get": {
+                            "responses": {
+                                "200": {
+                                    "description": "Successful Response",
+                                    "content": {"application/json": {"schema": {}}},
+                                },
+                                "422": {
+                                    "description": "Validation Error",
+                                    "content": {
+                                        "application/json": {
+                                            "schema": {
+                                                "$ref": "#/components/schemas/HTTPValidationError"
+                                            }
                                         }
-                                    }
+                                    },
                                 },
                             },
-                        },
-                        "summary": "Read Items",
-                        "operationId": "read_items_items__item_id__get",
-                        "parameters": [
-                            {
-                                "required": True,
-                                "schema": {"title": "Item Id", "type": "string"},
-                                "name": "item_id",
-                                "in": "path",
-                            }
-                        ],
+                            "summary": "Read Items",
+                            "operationId": "read_items_items__item_id__get",
+                            "parameters": [
+                                {
+                                    "required": True,
+                                    "schema": {"title": "Item Id", "type": "string"},
+                                    "name": "item_id",
+                                    "in": "path",
+                                }
+                            ],
+                        }
                     }
-                }
-            },
-            "components": {
-                "schemas": {
-                    "ValidationError": {
-                        "title": "ValidationError",
-                        "required": ["loc", "msg", "type"],
-                        "type": "object",
-                        "properties": {
-                            "ctx": {"title": "Context", "type": "object"},
-                            "input": {"title": "Input"},
-                            "loc": {
-                                "title": "Location",
-                                "type": "array",
-                                "items": {
-                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                },
+                "components": {
+                    "schemas": {
+                        "ValidationError": {
+                            "title": "ValidationError",
+                            "required": ["loc", "msg", "type"],
+                            "type": "object",
+                            "properties": {
+                                "ctx": {"title": "Context", "type": "object"},
+                                "input": {"title": "Input"},
+                                "loc": {
+                                    "title": "Location",
+                                    "type": "array",
+                                    "items": {
+                                        "anyOf": [
+                                            {"type": "string"},
+                                            {"type": "integer"},
+                                        ]
+                                    },
                                 },
+                                "msg": {"title": "Message", "type": "string"},
+                                "type": {"title": "Error Type", "type": "string"},
                             },
-                            "msg": {"title": "Message", "type": "string"},
-                            "type": {"title": "Error Type", "type": "string"},
                         },
-                    },
-                    "HTTPValidationError": {
-                        "title": "HTTPValidationError",
-                        "type": "object",
-                        "properties": {
-                            "detail": {
-                                "title": "Detail",
-                                "type": "array",
-                                "items": {
-                                    "$ref": "#/components/schemas/ValidationError"
-                                },
-                            }
+                        "HTTPValidationError": {
+                            "title": "HTTPValidationError",
+                            "type": "object",
+                            "properties": {
+                                "detail": {
+                                    "title": "Detail",
+                                    "type": "array",
+                                    "items": {
+                                        "$ref": "#/components/schemas/ValidationError"
+                                    },
+                                }
+                            },
                         },
-                    },
-                }
-            },
-        }
+                    }
+                },
+            }
+        )
index 0612899b55bca2c3df639c0fab29814e9cd0072e..f98d8921f763d919ade1689df89ca9a89b688df4 100644 (file)
@@ -1,6 +1,7 @@
 import pytest
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(name="app", scope="module")
@@ -23,21 +24,23 @@ def test_openapi_schema(app: FastAPI):
     with TestClient(app) as client:
         response = client.get("/openapi.json")
         assert response.status_code == 200, response.text
-        assert response.json() == {
-            "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",
+        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",
+                        }
                     }
-                }
-            },
-        }
+                },
+            }
+        )
index aed9def7ae799175433570af285fc9244e3916f7..4fc848e1166a1311b337ec5d47ad6656bcf5b5f1 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.events.tutorial003_py39 import (
     app,
@@ -21,74 +22,79 @@ def test_openapi_schema():
     with TestClient(app) as client:
         response = client.get("/openapi.json")
         assert response.status_code == 200, response.text
-        assert response.json() == {
-            "openapi": "3.1.0",
-            "info": {"title": "FastAPI", "version": "0.1.0"},
-            "paths": {
-                "/predict": {
-                    "get": {
-                        "summary": "Predict",
-                        "operationId": "predict_predict_get",
-                        "parameters": [
-                            {
-                                "required": True,
-                                "schema": {"title": "X", "type": "number"},
-                                "name": "x",
-                                "in": "query",
-                            }
-                        ],
-                        "responses": {
-                            "200": {
-                                "description": "Successful Response",
-                                "content": {"application/json": {"schema": {}}},
-                            },
-                            "422": {
-                                "description": "Validation Error",
-                                "content": {
-                                    "application/json": {
-                                        "schema": {
-                                            "$ref": "#/components/schemas/HTTPValidationError"
+        assert response.json() == snapshot(
+            {
+                "openapi": "3.1.0",
+                "info": {"title": "FastAPI", "version": "0.1.0"},
+                "paths": {
+                    "/predict": {
+                        "get": {
+                            "summary": "Predict",
+                            "operationId": "predict_predict_get",
+                            "parameters": [
+                                {
+                                    "required": True,
+                                    "schema": {"title": "X", "type": "number"},
+                                    "name": "x",
+                                    "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"
-                                },
-                            }
+                },
+                "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": {
-                            "ctx": {"title": "Context", "type": "object"},
-                            "input": {"title": "Input"},
-                            "loc": {
-                                "title": "Location",
-                                "type": "array",
-                                "items": {
-                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                        "ValidationError": {
+                            "title": "ValidationError",
+                            "required": ["loc", "msg", "type"],
+                            "type": "object",
+                            "properties": {
+                                "ctx": {"title": "Context", "type": "object"},
+                                "input": {"title": "Input"},
+                                "loc": {
+                                    "title": "Location",
+                                    "type": "array",
+                                    "items": {
+                                        "anyOf": [
+                                            {"type": "string"},
+                                            {"type": "integer"},
+                                        ]
+                                    },
                                 },
+                                "msg": {"title": "Message", "type": "string"},
+                                "type": {"title": "Error Type", "type": "string"},
                             },
-                            "msg": {"title": "Message", "type": "string"},
-                            "type": {"title": "Error Type", "type": "string"},
                         },
-                    },
-                }
-            },
-        }
+                    }
+                },
+            }
+        )
index 83ecb300ee597b4195daa802047cb8a26498a1be..bc10c888c14ef7d9e048643d9557761981d19297 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.extending_openapi.tutorial001_py39 import app
 
@@ -14,32 +15,34 @@ def test():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {
-            "title": "Custom title",
-            "summary": "This is a very custom OpenAPI schema",
-            "description": "Here's a longer description of the custom **OpenAPI** schema",
-            "version": "2.5.0",
-            "x-logo": {
-                "url": "https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {
+                "title": "Custom title",
+                "summary": "This is a very custom OpenAPI schema",
+                "description": "Here's a longer description of the custom **OpenAPI** schema",
+                "version": "2.5.0",
+                "x-logo": {
+                    "url": "https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png"
+                },
             },
-        },
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
     openapi_schema = response.json()
     # Request again to test the custom cache
     response = client.get("/openapi.json")
index 99816998621d7d5abe114ea376dd84161b27d04a..4248878b5a25e6ca7dea0e2725c8e6935793d97d 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -44,115 +45,119 @@ def test_post(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/user/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/UserOut",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/user/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/UserOut",
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create User",
+                        "operationId": "create_user_user__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/UserIn"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create User",
-                    "operationId": "create_user_user__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/UserIn"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "UserIn": {
-                    "title": "UserIn",
-                    "required": IsList(
-                        "username", "password", "email", check_order=False
-                    ),
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {"title": "Password", "type": "string"},
-                        "email": {
-                            "title": "Email",
-                            "type": "string",
-                            "format": "email",
-                        },
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "UserIn": {
+                        "title": "UserIn",
+                        "required": IsList(
+                            "username", "password", "email", check_order=False
+                        ),
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {"title": "Password", "type": "string"},
+                            "email": {
+                                "title": "Email",
+                                "type": "string",
+                                "format": "email",
+                            },
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "UserOut": {
-                    "title": "UserOut",
-                    "required": ["username", "email"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "email": {
-                            "title": "Email",
-                            "type": "string",
-                            "format": "email",
-                        },
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "UserOut": {
+                        "title": "UserOut",
+                        "required": ["username", "email"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "email": {
+                                "title": "Email",
+                                "type": "string",
+                                "format": "email",
+                            },
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 073375ccc96e2a05bb22fc3767ebd39513859246..c64371e3bee8067d93b7abaca72e2bf6772e6bbf 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -29,42 +30,46 @@ def test_get_items(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Read Items Items  Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+    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": {
+                                            "title": "Response Read Items Items  Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
+                                },
+                            }
+                        },
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "description"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {"title": "Description", "type": "string"},
-                    },
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "description"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {"title": "Description", "type": "string"},
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 8e52d8d4bab7681d7046d7435752bb4f648ec9f0..43b8bae8e543b6cfd7b82179ca8636d69ff7e6ea 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -26,29 +27,31 @@ def test_get_items(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/keyword-weights/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Read Keyword Weights Keyword Weights  Get",
-                                        "type": "object",
-                                        "additionalProperties": {"type": "number"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/keyword-weights/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Read Keyword Weights Keyword Weights  Get",
+                                            "type": "object",
+                                            "additionalProperties": {"type": "number"},
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                    "summary": "Read Keyword Weights",
-                    "operationId": "read_keyword_weights_keyword_weights__get",
+                                },
+                            }
+                        },
+                        "summary": "Read Keyword Weights",
+                        "operationId": "read_keyword_weights_keyword_weights__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index aa65218cdef4c67f33b77c09e61377ac2974cf50..5457ad132a3028e69e02edecc7fd677bf6673e91 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -33,21 +34,23 @@ def test_get_path(client: TestClient, path, expected_status, expected_response):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Root",
-                    "operationId": "root__get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Root",
+                        "operationId": "root__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 83ae38c5b52ea0ae55b6d9c676af858f35dc8ca4..62799d259b50df7a6bb831c897fd05536b99b014 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -34,111 +35,119 @@ def test_get_items(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Get Items",
-                    "operationId": "get_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Get Items Items  Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Get Items",
+                        "operationId": "get_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Get Items Items  Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                },
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+                                },
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "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"},
-                        }
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
                     },
-                },
-                "ResponseMessage": {
-                    "title": "ResponseMessage",
-                    "required": ["message"],
-                    "type": "object",
-                    "properties": {"message": {"title": "Message", "type": "string"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ResponseMessage": {
+                        "title": "ResponseMessage",
+                        "required": ["message"],
+                        "type": "object",
+                        "properties": {
+                            "message": {"title": "Message", "type": "string"}
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index b9255325aac9b01da809cca6c17edb62d20065f6..f64f5f8666ec3ca96674eb2422a3d2684ee3cf78 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.generate_clients.tutorial002_py39 import app
 
@@ -31,159 +32,167 @@ def test_get_items():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Get Items",
-                    "operationId": "get_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Get Items Items  Get",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Get Items",
+                        "operationId": "get_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Get Items Items  Get",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                },
-                "post": {
-                    "tags": ["items"],
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+                                },
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    "post": {
+                        "tags": ["items"],
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
-            },
-            "/users/": {
-                "post": {
-                    "tags": ["users"],
-                    "summary": "Create User",
-                    "operationId": "create_user_users__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/User"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                "/users/": {
+                    "post": {
+                        "tags": ["users"],
+                        "summary": "Create User",
+                        "operationId": "create_user_users__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/User"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "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"},
-                        }
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
                     },
-                },
-                "ResponseMessage": {
-                    "title": "ResponseMessage",
-                    "required": ["message"],
-                    "type": "object",
-                    "properties": {"message": {"title": "Message", "type": "string"}},
-                },
-                "User": {
-                    "title": "User",
-                    "required": ["username", "email"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "email": {"title": "Email", "type": "string"},
+                    "ResponseMessage": {
+                        "title": "ResponseMessage",
+                        "required": ["message"],
+                        "type": "object",
+                        "properties": {
+                            "message": {"title": "Message", "type": "string"}
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "User": {
+                        "title": "User",
+                        "required": ["username", "email"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "email": {"title": "Email", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index d05484587981edf39665cc05a8c5afd033b38340..34ede61946f1e5caa66ae07b458176ad37dc252f 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.generate_clients.tutorial003_py39 import app
 
@@ -31,159 +32,167 @@ def test_get_items():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Get Items",
-                    "operationId": "items-get_items",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "title": "Response Items-Get Items",
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Get Items",
+                        "operationId": "items-get_items",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "title": "Response Items-Get Items",
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                },
-                "post": {
-                    "tags": ["items"],
-                    "summary": "Create Item",
-                    "operationId": "items-create_item",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+                                },
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    "post": {
+                        "tags": ["items"],
+                        "summary": "Create Item",
+                        "operationId": "items-create_item",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
-            },
-            "/users/": {
-                "post": {
-                    "tags": ["users"],
-                    "summary": "Create User",
-                    "operationId": "users-create_user",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/User"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                "/users/": {
+                    "post": {
+                        "tags": ["users"],
+                        "summary": "Create User",
+                        "operationId": "users-create_user",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/User"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage"
+                                        }
                                     }
-                                }
+                                },
+                            },
+                            "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"},
-                        }
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                        },
                     },
-                },
-                "ResponseMessage": {
-                    "title": "ResponseMessage",
-                    "required": ["message"],
-                    "type": "object",
-                    "properties": {"message": {"title": "Message", "type": "string"}},
-                },
-                "User": {
-                    "title": "User",
-                    "required": ["username", "email"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "email": {"title": "Email", "type": "string"},
+                    "ResponseMessage": {
+                        "title": "ResponseMessage",
+                        "required": ["message"],
+                        "type": "object",
+                        "properties": {
+                            "message": {"title": "Message", "type": "string"}
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "User": {
+                        "title": "User",
+                        "required": ["username", "email"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "email": {"title": "Email", "type": "string"},
+                        },
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index eea60e3428f5ac3e2918e5fc0d3cdfdb86e79a57..d04bfbfe877f60bc5f8a220a6ff4364b8979fced 100644 (file)
@@ -3,6 +3,8 @@ import json
 import pathlib
 from unittest.mock import patch
 
+from inline_snapshot import snapshot
+
 from docs_src.generate_clients import tutorial003_py39
 
 
@@ -15,218 +17,220 @@ def test_remove_tags(tmp_path: pathlib.Path):
         importlib.import_module("docs_src.generate_clients.tutorial004_py39")
 
     modified_openapi = json.loads(tmp_file.read_text())
-    assert modified_openapi == {
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
-                            },
-                            "title": "Detail",
-                            "type": "array",
-                        },
-                    },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
+    assert modified_openapi == snapshot(
+        {
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
+                            },
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ResponseMessage": {
-                    "properties": {
-                        "message": {
-                            "title": "Message",
-                            "type": "string",
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
                         },
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
                     },
-                    "required": [
-                        "message",
-                    ],
-                    "title": "ResponseMessage",
-                    "type": "object",
-                },
-                "User": {
-                    "properties": {
-                        "email": {
-                            "title": "Email",
-                            "type": "string",
-                        },
-                        "username": {
-                            "title": "Username",
-                            "type": "string",
+                    "ResponseMessage": {
+                        "properties": {
+                            "message": {
+                                "title": "Message",
+                                "type": "string",
+                            },
                         },
+                        "required": [
+                            "message",
+                        ],
+                        "title": "ResponseMessage",
+                        "type": "object",
                     },
-                    "required": [
-                        "username",
-                        "email",
-                    ],
-                    "title": "User",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "User": {
+                        "properties": {
+                            "email": {
+                                "title": "Email",
+                                "type": "string",
+                            },
+                            "username": {
+                                "title": "Username",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "username",
+                            "email",
+                        ],
+                        "title": "User",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
-                },
-            },
-        },
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/items/": {
-                "get": {
-                    "operationId": "get_items",
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "items": {
-                                            "$ref": "#/components/schemas/Item",
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
                                         },
-                                        "title": "Response Items-Get Items",
-                                        "type": "array",
-                                    },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
                                 },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "description": "Successful Response",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "summary": "Get Items",
-                    "tags": [
-                        "items",
-                    ],
                 },
-                "post": {
-                    "operationId": "create_item",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
+            },
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "operationId": "get_items",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item",
+                                            },
+                                            "title": "Response Items-Get Items",
+                                            "type": "array",
+                                        },
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
                         },
-                        "required": True,
+                        "summary": "Get Items",
+                        "tags": [
+                            "items",
+                        ],
                     },
-                    "responses": {
-                        "200": {
+                    "post": {
+                        "operationId": "create_item",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage",
+                                        "$ref": "#/components/schemas/Item",
                                     },
                                 },
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage",
+                                        },
                                     },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Validation Error",
-                        },
-                    },
-                    "summary": "Create Item",
-                    "tags": [
-                        "items",
-                    ],
-                },
-            },
-            "/users/": {
-                "post": {
-                    "operationId": "create_user",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/User",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
+                                    },
                                 },
+                                "description": "Validation Error",
                             },
                         },
-                        "required": True,
+                        "summary": "Create Item",
+                        "tags": [
+                            "items",
+                        ],
                     },
-                    "responses": {
-                        "200": {
+                },
+                "/users/": {
+                    "post": {
+                        "operationId": "create_user",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/ResponseMessage",
+                                        "$ref": "#/components/schemas/User",
                                     },
                                 },
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/ResponseMessage",
+                                        },
+                                    },
+                                },
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Create User",
+                        "tags": [
+                            "users",
+                        ],
                     },
-                    "summary": "Create User",
-                    "tags": [
-                        "users",
-                    ],
                 },
             },
-        },
-    }
+        }
+    )
index 9ba7147b550fca3bb6326f59662b665aa730de61..cc3be6a1905b0b1afb56ee4a1082b310ac78db22 100644 (file)
@@ -1,6 +1,7 @@
 import warnings
 
 import pytest
+from inline_snapshot import snapshot
 from starlette.testclient import TestClient
 
 warnings.filterwarnings(
@@ -26,45 +27,47 @@ def test_query(client: TestClient):
 def test_openapi(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/graphql": {
-                "get": {
-                    "operationId": "handle_http_get_graphql_get",
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+    assert response.json() == snapshot(
+        {
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/graphql": {
+                    "get": {
+                        "operationId": "handle_http_get_graphql_get",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "The GraphiQL integrated development environment.",
+                            },
+                            "404": {
+                                "description": "Not found if GraphiQL or query via GET are not enabled.",
                             },
-                            "description": "The GraphiQL integrated development environment.",
-                        },
-                        "404": {
-                            "description": "Not found if GraphiQL or query via GET are not enabled.",
                         },
+                        "summary": "Handle Http Get",
                     },
-                    "summary": "Handle Http Get",
-                },
-                "post": {
-                    "operationId": "handle_http_post_graphql_post",
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+                    "post": {
+                        "operationId": "handle_http_post_graphql_post",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
                         },
+                        "summary": "Handle Http Post",
                     },
-                    "summary": "Handle Http Post",
                 },
             },
-        },
-    }
+        }
+    )
index e22f1dafd4fb79a348fd548899a5ade75ba2868e..8283cdc73ed17276dc3da7d2d8fc608bc2d1536d 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.handling_errors.tutorial001_py39 import app
 
@@ -21,72 +22,76 @@ def test_get_item_not_found():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 991478a0fe6e7294be25b05c7dc07446b1c0ee1f..c437693d3d1ea0da928a2a4a77f4271b869dd947 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.handling_errors.tutorial002_py39 import app
 
@@ -21,72 +22,76 @@ def test_get_item_not_found_header():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items-header/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items-header/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item Header",
-                    "operationId": "read_item_header_items_header__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Item Header",
+                        "operationId": "read_item_header_items_header__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c303960bde14f0130e1028ab0080ceaee30a3c63..959729e53f804cc45e03d4f0f53d30c27c75a574 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.handling_errors.tutorial003_py39 import app
 
@@ -22,72 +23,76 @@ def test_get_exception():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/unicorns/{name}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/unicorns/{name}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Unicorn",
-                    "operationId": "read_unicorn_unicorns__name__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Name", "type": "string"},
-                            "name": "name",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Unicorn",
+                        "operationId": "read_unicorn_unicorns__name__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Name", "type": "string"},
+                                "name": "name",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f6ec59b4d0f8ee30e78b245e40fddde957e83a2a..16165bb3d35aae7a8e744acbc9b939f8c164541e 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.handling_errors.tutorial004_py39 import app
 
@@ -27,72 +28,76 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index a7fa4f0b6485de28a78e6b9a9391284bd1e993b9..af924a9f76d858fd4fa771aedcd84ad6ce4aa064 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.handling_errors.tutorial005_py39 import app
 
@@ -31,81 +32,85 @@ def test_post():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["title", "size"],
-                    "type": "object",
-                    "properties": {
-                        "title": {"title": "Title", "type": "string"},
-                        "size": {"title": "Size", "type": "integer"},
+                    "Item": {
+                        "title": "Item",
+                        "required": ["title", "size"],
+                        "type": "object",
+                        "properties": {
+                            "title": {"title": "Title", "type": "string"},
+                            "size": {"title": "Size", "type": "integer"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 9cb57d857d66ae29b9bc71e3bdd64c4b07c6e1c2..4c069d81e23903de4ad8b4c4d4481e4d38d5c732 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.handling_errors.tutorial006_py39 import app
 
@@ -35,72 +36,76 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 60342f70a41b09491ed08b60e2f508b9208b341f..2e97a832217a95a1846f632c2a8ef236d00c3e48 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -39,75 +40,79 @@ def test(path, headers, expected_status, expected_response, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "User-Agent",
-                            },
-                            "name": "user-agent",
-                            "in": "header",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "User-Agent",
+                                },
+                                "name": "user-agent",
+                                "in": "header",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f1ced99b1b30eda99c97e96ce2c5a14ab97aea3e..ba86c55bf693abb81a1ea3eec5d2c8fbf621e0a6 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -50,75 +51,79 @@ def test(path, headers, expected_status, expected_response, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "string"}, {"type": "null"}],
-                                "title": "Strange Header",
-                            },
-                            "name": "strange_header",
-                            "in": "header",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "string"}, {"type": "null"}],
+                                    "title": "Strange Header",
+                                },
+                                "name": "strange_header",
+                                "in": "header",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 382c3ae19161b810de26f1329e9c191a7c97db2c..30e5133c01d0bb00b082865094939cd33420d183 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -44,78 +45,82 @@ def test(path, headers, expected_status, expected_response, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "X-Token",
-                                "anyOf": [
-                                    {"type": "array", "items": {"type": "string"}},
-                                    {"type": "null"},
-                                ],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "X-Token",
+                                    "anyOf": [
+                                        {"type": "array", "items": {"type": "string"}},
+                                        {"type": "null"},
+                                    ],
+                                },
+                                "name": "x-token",
+                                "in": "header",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                            "name": "x-token",
-                            "in": "header",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index ead48577d053ebf442b393f4df140eb7a9a79815..ba3c09ce4cea071cf0a9923158d7f71e087e4483 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.metadata.tutorial001_py39 import app
 
@@ -14,36 +15,38 @@ def test_items():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {
-            "title": "ChimichangApp",
-            "summary": "Deadpool's favorite app. Nuff said.",
-            "description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.\n\n## Users\n\nYou will be able to:\n\n* **Create users** (_not implemented_).\n* **Read users** (_not implemented_).\n",
-            "termsOfService": "http://example.com/terms/",
-            "contact": {
-                "name": "Deadpoolio the Amazing",
-                "url": "http://x-force.example.com/contact/",
-                "email": "dp@x-force.example.com",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {
+                "title": "ChimichangApp",
+                "summary": "Deadpool's favorite app. Nuff said.",
+                "description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.\n\n## Users\n\nYou will be able to:\n\n* **Create users** (_not implemented_).\n* **Read users** (_not implemented_).\n",
+                "termsOfService": "http://example.com/terms/",
+                "contact": {
+                    "name": "Deadpoolio the Amazing",
+                    "url": "http://x-force.example.com/contact/",
+                    "email": "dp@x-force.example.com",
+                },
+                "license": {
+                    "name": "Apache 2.0",
+                    "url": "https://www.apache.org/licenses/LICENSE-2.0.html",
+                },
+                "version": "0.0.1",
             },
-            "license": {
-                "name": "Apache 2.0",
-                "url": "https://www.apache.org/licenses/LICENSE-2.0.html",
-            },
-            "version": "0.0.1",
-        },
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 10cb35c546499a02fc6f8fcc1ff3c05177dd7c9c..9339549731055da700e3195ce65c012f01b43ce1 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.metadata.tutorial001_1_py39 import app
 
@@ -14,36 +15,38 @@ def test_items():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {
-            "title": "ChimichangApp",
-            "summary": "Deadpool's favorite app. Nuff said.",
-            "description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.\n\n## Users\n\nYou will be able to:\n\n* **Create users** (_not implemented_).\n* **Read users** (_not implemented_).\n",
-            "termsOfService": "http://example.com/terms/",
-            "contact": {
-                "name": "Deadpoolio the Amazing",
-                "url": "http://x-force.example.com/contact/",
-                "email": "dp@x-force.example.com",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {
+                "title": "ChimichangApp",
+                "summary": "Deadpool's favorite app. Nuff said.",
+                "description": "\nChimichangApp API helps you do awesome stuff. 🚀\n\n## Items\n\nYou can **read items**.\n\n## Users\n\nYou will be able to:\n\n* **Create users** (_not implemented_).\n* **Read users** (_not implemented_).\n",
+                "termsOfService": "http://example.com/terms/",
+                "contact": {
+                    "name": "Deadpoolio the Amazing",
+                    "url": "http://x-force.example.com/contact/",
+                    "email": "dp@x-force.example.com",
+                },
+                "license": {
+                    "name": "Apache 2.0",
+                    "identifier": "Apache-2.0",
+                },
+                "version": "0.0.1",
             },
-            "license": {
-                "name": "Apache 2.0",
-                "identifier": "Apache-2.0",
-            },
-            "version": "0.0.1",
-        },
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index e2814c88f985e7dc5555b3e44ea9ab11480d35d8..5a252475eb49c213fd129180ff9f2ad973aed0e8 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.metadata.tutorial002_py39 import app
 
@@ -19,24 +20,26 @@ def test_get_openapi_json_default_url():
 def test_openapi_schema():
     response = client.get("/api/v1/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 085c271cdb758825ec92ae30f4b3882b0cdca66f..778781e6653d67086bc10010401b49b549901a64 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.metadata.tutorial003_py39 import app
 
@@ -14,27 +15,29 @@ def test_items():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
 
 
 def test_swagger_ui_default_url():
index 4ef93fd5e3bcd47eb00748156cd52693895d5898..5c309a830ed733a1884ddcba9f9f294e55ba4fba 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.metadata.tutorial004_py39 import app
 
@@ -15,49 +16,51 @@ def test_path_operations():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/": {
-                "get": {
-                    "tags": ["users"],
-                    "summary": "Get Users",
-                    "operationId": "get_users_users__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/": {
+                    "get": {
+                        "tags": ["users"],
+                        "summary": "Get Users",
+                        "operationId": "get_users_users__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/items/": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Get Items",
+                        "operationId": "get_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
             },
-            "/items/": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Get Items",
-                    "operationId": "get_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
+            "tags": [
+                {
+                    "name": "users",
+                    "description": "Operations with users. The **login** logic is also here.",
+                },
+                {
+                    "name": "items",
+                    "description": "Manage items. So _fancy_ they have their own docs.",
+                    "externalDocs": {
+                        "description": "Items external docs",
+                        "url": "https://fastapi.tiangolo.com/",
                     },
-                }
-            },
-        },
-        "tags": [
-            {
-                "name": "users",
-                "description": "Operations with users. The **login** logic is also here.",
-            },
-            {
-                "name": "items",
-                "description": "Manage items. So _fancy_ they have their own docs.",
-                "externalDocs": {
-                    "description": "Items external docs",
-                    "url": "https://fastapi.tiangolo.com/",
                 },
-            },
-        ],
-    }
+            ],
+        }
+    )
index cbcfd4146fc8c8c4e72c8321c1dcb8ff288fec42..18047f3430ed2049e5d168a736a2d941639951df 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.middleware.tutorial001_py39 import app
 
@@ -14,11 +15,13 @@ def test_response_headers():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "paths": {},
-    }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "paths": {},
+        }
+    )
index e8c98e8063fa444c8ba40c4badbe3d6a34c4450d..1e937d0c90517f714796ddd081e3f4557ec77f33 100644 (file)
@@ -3,6 +3,7 @@ from types import ModuleType
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from tests.utils import needs_py310
 
@@ -42,163 +43,167 @@ def test_dummy_callback(mod: ModuleType):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/invoices/": {
-                "post": {
-                    "summary": "Create Invoice",
-                    "description": 'Create an invoice.\n\nThis will (let\'s imagine) let the API user (some external developer) create an\ninvoice.\n\nAnd this path operation will:\n\n* Send the invoice to the client.\n* Collect the money from the client.\n* Send a notification back to the API user (the external developer), as a callback.\n    * At this point is that the API will somehow send a POST request to the\n        external API with the notification of the invoice event\n        (e.g. "payment successful").',
-                    "operationId": "create_invoice_invoices__post",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "format": "uri",
-                                        "minLength": 1,
-                                        "maxLength": 2083,
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Callback Url",
-                            },
-                            "name": "callback_url",
-                            "in": "query",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Invoice"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/invoices/": {
+                    "post": {
+                        "summary": "Create Invoice",
+                        "description": 'Create an invoice.\n\nThis will (let\'s imagine) let the API user (some external developer) create an\ninvoice.\n\nAnd this path operation will:\n\n* Send the invoice to the client.\n* Collect the money from the client.\n* Send a notification back to the API user (the external developer), as a callback.\n    * At this point is that the API will somehow send a POST request to the\n        external API with the notification of the invoice event\n        (e.g. "payment successful").',
+                        "operationId": "create_invoice_invoices__post",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "format": "uri",
+                                            "minLength": 1,
+                                            "maxLength": 2083,
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Callback Url",
+                                },
+                                "name": "callback_url",
+                                "in": "query",
                             }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Invoice"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "callbacks": {
-                        "invoice_notification": {
-                            "{$callback_url}/invoices/{$request.body.id}": {
-                                "post": {
-                                    "summary": "Invoice Notification",
-                                    "operationId": "invoice_notification__callback_url__invoices___request_body_id__post",
-                                    "requestBody": {
-                                        "required": True,
-                                        "content": {
-                                            "application/json": {
-                                                "schema": {
-                                                    "$ref": "#/components/schemas/InvoiceEvent"
-                                                }
-                                            }
-                                        },
-                                    },
-                                    "responses": {
-                                        "200": {
-                                            "description": "Successful Response",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                        "callbacks": {
+                            "invoice_notification": {
+                                "{$callback_url}/invoices/{$request.body.id}": {
+                                    "post": {
+                                        "summary": "Invoice Notification",
+                                        "operationId": "invoice_notification__callback_url__invoices___request_body_id__post",
+                                        "requestBody": {
+                                            "required": True,
                                             "content": {
                                                 "application/json": {
                                                     "schema": {
-                                                        "$ref": "#/components/schemas/InvoiceEventReceived"
+                                                        "$ref": "#/components/schemas/InvoiceEvent"
                                                     }
                                                 }
                                             },
                                         },
-                                        "422": {
-                                            "description": "Validation Error",
-                                            "content": {
-                                                "application/json": {
-                                                    "schema": {
-                                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "responses": {
+                                            "200": {
+                                                "description": "Successful Response",
+                                                "content": {
+                                                    "application/json": {
+                                                        "schema": {
+                                                            "$ref": "#/components/schemas/InvoiceEventReceived"
+                                                        }
                                                     }
-                                                }
+                                                },
+                                            },
+                                            "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"},
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "Invoice": {
-                    "title": "Invoice",
-                    "required": ["id", "customer", "total"],
-                    "type": "object",
-                    "properties": {
-                        "id": {"title": "Id", "type": "string"},
-                        "title": {
-                            "title": "Title",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "Invoice": {
+                        "title": "Invoice",
+                        "required": ["id", "customer", "total"],
+                        "type": "object",
+                        "properties": {
+                            "id": {"title": "Id", "type": "string"},
+                            "title": {
+                                "title": "Title",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "customer": {"title": "Customer", "type": "string"},
+                            "total": {"title": "Total", "type": "number"},
                         },
-                        "customer": {"title": "Customer", "type": "string"},
-                        "total": {"title": "Total", "type": "number"},
                     },
-                },
-                "InvoiceEvent": {
-                    "title": "InvoiceEvent",
-                    "required": ["description", "paid"],
-                    "type": "object",
-                    "properties": {
-                        "description": {"title": "Description", "type": "string"},
-                        "paid": {"title": "Paid", "type": "boolean"},
+                    "InvoiceEvent": {
+                        "title": "InvoiceEvent",
+                        "required": ["description", "paid"],
+                        "type": "object",
+                        "properties": {
+                            "description": {"title": "Description", "type": "string"},
+                            "paid": {"title": "Paid", "type": "boolean"},
+                        },
                     },
-                },
-                "InvoiceEventReceived": {
-                    "title": "InvoiceEventReceived",
-                    "required": ["ok"],
-                    "type": "object",
-                    "properties": {"ok": {"title": "Ok", "type": "boolean"}},
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "InvoiceEventReceived": {
+                        "title": "InvoiceEventReceived",
+                        "required": ["ok"],
+                        "type": "object",
+                        "properties": {"ok": {"title": "Ok", "type": "boolean"}},
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c58e0fd02c2da8bcbb17d93b5ff26b36ace06d54..0482c94bf96683af4698277e189f5b92e43f49a5 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.openapi_webhooks.tutorial001_py39 import app
 
@@ -19,101 +20,107 @@ def test_dummy_webhook():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/": {
-                "get": {
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            }
-        },
-        "webhooks": {
-            "new-subscription": {
-                "post": {
-                    "summary": "New Subscription",
-                    "description": "When a new user subscribes to your service we'll send you a POST request with this\ndata to the URL that you register for the event `new-subscription` in the dashboard.",
-                    "operationId": "new_subscriptionnew_subscription_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Subscription"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/": {
+                    "get": {
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                }
+            },
+            "webhooks": {
+                "new-subscription": {
+                    "post": {
+                        "summary": "New Subscription",
+                        "description": "When a new user subscribes to your service we'll send you a POST request with this\ndata to the URL that you register for the event `new-subscription` in the dashboard.",
+                        "operationId": "new_subscriptionnew_subscription_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Subscription"
                                     }
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Subscription": {
-                    "properties": {
-                        "username": {"type": "string", "title": "Username"},
-                        "monthly_fee": {"type": "number", "title": "Monthly Fee"},
-                        "start_date": {
-                            "type": "string",
-                            "format": "date-time",
-                            "title": "Start Date",
+                    "Subscription": {
+                        "properties": {
+                            "username": {"type": "string", "title": "Username"},
+                            "monthly_fee": {"type": "number", "title": "Monthly Fee"},
+                            "start_date": {
+                                "type": "string",
+                                "format": "date-time",
+                                "title": "Start Date",
+                            },
                         },
+                        "type": "object",
+                        "required": ["username", "monthly_fee", "start_date"],
+                        "title": "Subscription",
                     },
-                    "type": "object",
-                    "required": ["username", "monthly_fee", "start_date"],
-                    "title": "Subscription",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index ee0b707108242d6be79988f9153c7e621bc8d48b..3a4f648241123c7a1de1935f862ac14a7a3ed4a5 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_advanced_configuration.tutorial001_py39 import app
 
@@ -14,21 +15,23 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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": "some_specific_id_you_define",
+    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": "some_specific_id_you_define",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index f6580d72e3d283ec3c69505b4b88a561b6ae2f1a..c26c36030b962da40e230c899c1348f431d2d1ff 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_advanced_configuration.tutorial002_py39 import app
 
@@ -14,21 +15,23 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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",
+    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",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 104554fce388b5b38eb7689a101e9571c0b68239..f060647b2981579c583bfc74547fb2eb3c41a2d8 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_advanced_configuration.tutorial003_py39 import app
 
@@ -14,8 +15,10 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {},
-    }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {},
+        }
+    )
index 75b08a4e75d6451f8bc4ded249bce6882c537174..bf79345449c461cc44af40bfda4de0f1ee87d3dd 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -38,101 +39,105 @@ def test_query_params_str_validations(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create an item",
+                        "description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create an item",
-                    "description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "uniqueItems": True,
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "default": [],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "uniqueItems": True,
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "default": [],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index e2a71236ffc0af69d3ff450d1d6e08770143c81c..779e54f9e75168e72c3418d1c9982a0d683a0112 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_advanced_configuration.tutorial005_py39 import app
 
@@ -13,22 +14,24 @@ def test_get():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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",
-                    "x-aperture-labs-portal": "blue",
+    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",
+                        "x-aperture-labs-portal": "blue",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 9484f7f57348aa204789e7c563dd0bae118baaf7..d63b5f912d2067cf90bd85a18c664aa38cbba6f4 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_advanced_configuration.tutorial006_py39 import app
 
@@ -21,37 +22,39 @@ def test_post():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "required": ["name", "price"],
-                                    "type": "object",
-                                    "properties": {
-                                        "name": {"type": "string"},
-                                        "price": {"type": "number"},
-                                        "description": {"type": "string"},
-                                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
+                            "content": {
+                                "application/json": {
+                                    "schema": {
+                                        "required": ["name", "price"],
+                                        "type": "object",
+                                        "properties": {
+                                            "name": {"type": "string"},
+                                            "price": {"type": "number"},
+                                            "description": {"type": "string"},
+                                        },
+                                    }
                                 }
+                            },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index d5f284e3bd3e9500e0c2b3586196ca0072b4ce2e..ec0c91bdad97b426dc31d2d6b640b837df277992 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -75,41 +76,43 @@ def test_post_invalid(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-yaml": {
-                                "schema": {
-                                    "title": "Item",
-                                    "required": ["name", "tags"],
-                                    "type": "object",
-                                    "properties": {
-                                        "name": {"title": "Name", "type": "string"},
-                                        "tags": {
-                                            "title": "Tags",
-                                            "type": "array",
-                                            "items": {"type": "string"},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
+                            "content": {
+                                "application/x-yaml": {
+                                    "schema": {
+                                        "title": "Item",
+                                        "required": ["name", "tags"],
+                                        "type": "object",
+                                        "properties": {
+                                            "name": {"title": "Name", "type": "string"},
+                                            "tags": {
+                                                "title": "Tags",
+                                                "type": "array",
+                                                "items": {"type": "string"},
+                                            },
                                         },
-                                    },
+                                    }
                                 }
+                            },
+                            "required": True,
+                        },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index de81251d041964fe8b7499d45b10154021fdb2e4..500cb057c539e2faeaaf118a68af54f553f3de1b 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -45,144 +46,146 @@ def test_post_items(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "201": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "201": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "description": {
-                            "anyOf": [
-                                {
-                                    "type": "string",
-                                },
-                                {
-                                    "type": "null",
-                                },
-                            ],
-                            "title": "Description",
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tags": {
-                            "default": [],
-                            "items": {
+                    "Item": {
+                        "properties": {
+                            "description": {
+                                "anyOf": [
+                                    {
+                                        "type": "string",
+                                    },
+                                    {
+                                        "type": "null",
+                                    },
+                                ],
+                                "title": "Description",
+                            },
+                            "name": {
+                                "title": "Name",
                                 "type": "string",
                             },
-                            "title": "Tags",
-                            "type": "array",
-                            "uniqueItems": True,
-                        },
-                        "tax": {
-                            "anyOf": [
-                                {
-                                    "type": "number",
-                                },
-                                {
-                                    "type": "null",
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tags": {
+                                "default": [],
+                                "items": {
+                                    "type": "string",
                                 },
-                            ],
-                            "title": "Tax",
-                        },
-                    },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
+                                "title": "Tags",
+                                "type": "array",
+                                "uniqueItems": True,
+                            },
+                            "tax": {
                                 "anyOf": [
                                     {
-                                        "type": "string",
+                                        "type": "number",
                                     },
                                     {
-                                        "type": "integer",
+                                        "type": "null",
                                     },
                                 ],
+                                "title": "Tax",
                             },
-                            "title": "Location",
-                            "type": "array",
                         },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
+                            },
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 28e5e7d8d199037d0aa7bf6f73f1ebc278a7d9a4..1cc560cb9a6d52ddbc089eb9eb948b47908f23e9 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -57,169 +58,171 @@ def test_get_users(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                },
-                "post": {
-                    "tags": ["items"],
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    "post": {
+                        "tags": ["items"],
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
-            },
-            "/users/": {
-                "get": {
-                    "tags": ["users"],
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
-                            },
-                            "title": "Detail",
-                            "type": "array",
+                "/users/": {
+                    "get": {
+                        "tags": ["users"],
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
                         },
-                    },
-                    "title": "HTTPValidationError",
-                    "type": "object",
+                    }
                 },
-                "Item": {
-                    "properties": {
-                        "description": {
-                            "anyOf": [
-                                {
-                                    "type": "string",
-                                },
-                                {
-                                    "type": "null",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
                                 },
-                            ],
-                            "title": "Description",
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tags": {
-                            "default": [],
-                            "items": {
-                                "type": "string",
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Tags",
-                            "type": "array",
-                            "uniqueItems": True,
-                        },
-                        "tax": {
-                            "anyOf": [
-                                {
-                                    "type": "number",
-                                },
-                                {
-                                    "type": "null",
-                                },
-                            ],
-                            "title": "Tax",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
+                    "Item": {
+                        "properties": {
+                            "description": {
                                 "anyOf": [
                                     {
                                         "type": "string",
                                     },
                                     {
-                                        "type": "integer",
+                                        "type": "null",
                                     },
                                 ],
+                                "title": "Description",
+                            },
+                            "name": {
+                                "title": "Name",
+                                "type": "string",
+                            },
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tags": {
+                                "default": [],
+                                "items": {
+                                    "type": "string",
+                                },
+                                "title": "Tags",
+                                "type": "array",
+                                "uniqueItems": True,
+                            },
+                            "tax": {
+                                "anyOf": [
+                                    {
+                                        "type": "number",
+                                    },
+                                    {
+                                        "type": "null",
+                                    },
+                                ],
+                                "title": "Tax",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
                         },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
+                            },
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 5a0193adfaab2e22557ac9142b0b376244393cf6..98319645c26c3250c94dd58ee0f3d7b5222610c1 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_configuration.tutorial002b_py39 import app
 
@@ -20,35 +21,37 @@ def test_get_users():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "tags": ["items"],
-                    "summary": "Get Items",
-                    "operationId": "get_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "tags": ["items"],
+                        "summary": "Get Items",
+                        "operationId": "get_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
+                "/users/": {
+                    "get": {
+                        "tags": ["users"],
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
             },
-            "/users/": {
-                "get": {
-                    "tags": ["users"],
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
-            },
-        },
-    }
+        }
+    )
index e42c3e2b73dcf083c2e61429435bccc51c09b8cb..8e86cd8a516af13087465acaab48ad8c9e0b9f26 100644 (file)
@@ -4,6 +4,7 @@ from textwrap import dedent
 import pytest
 from dirty_equals import IsList
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -66,145 +67,147 @@ def test_openapi_schema(client: TestClient, mod_name: str):
 
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "summary": "Create an item",
-                    "description": DESCRIPTIONS[mod_name],
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "summary": "Create an item",
+                        "description": DESCRIPTIONS[mod_name],
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
                     },
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "Item": {
-                    "properties": {
-                        "description": {
-                            "anyOf": [
-                                {
-                                    "type": "string",
-                                },
-                                {
-                                    "type": "null",
-                                },
-                            ],
-                            "title": "Description",
-                        },
-                        "name": {
-                            "title": "Name",
-                            "type": "string",
-                        },
-                        "price": {
-                            "title": "Price",
-                            "type": "number",
-                        },
-                        "tags": {
-                            "default": [],
-                            "items": {
+                    "Item": {
+                        "properties": {
+                            "description": {
+                                "anyOf": [
+                                    {
+                                        "type": "string",
+                                    },
+                                    {
+                                        "type": "null",
+                                    },
+                                ],
+                                "title": "Description",
+                            },
+                            "name": {
+                                "title": "Name",
                                 "type": "string",
                             },
-                            "title": "Tags",
-                            "type": "array",
-                            "uniqueItems": True,
-                        },
-                        "tax": {
-                            "anyOf": [
-                                {
-                                    "type": "number",
-                                },
-                                {
-                                    "type": "null",
+                            "price": {
+                                "title": "Price",
+                                "type": "number",
+                            },
+                            "tags": {
+                                "default": [],
+                                "items": {
+                                    "type": "string",
                                 },
-                            ],
-                            "title": "Tax",
-                        },
-                    },
-                    "required": [
-                        "name",
-                        "price",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
+                                "title": "Tags",
+                                "type": "array",
+                                "uniqueItems": True,
+                            },
+                            "tax": {
                                 "anyOf": [
                                     {
-                                        "type": "string",
+                                        "type": "number",
                                     },
                                     {
-                                        "type": "integer",
+                                        "type": "null",
                                     },
                                 ],
+                                "title": "Tax",
                             },
-                            "title": "Location",
-                            "type": "array",
                         },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
+                        "required": [
+                            "name",
+                            "price",
+                        ],
+                        "title": "Item",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
+                            },
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index b684c9f5c2729f0bf82d0bbb00354aa982a23691..07152755f58ab78c594046c77010146a8c05703c 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -37,101 +38,105 @@ def test_query_params_str_validations(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "The created item",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "The created item",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"}
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create an item",
+                        "description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create an item",
-                    "description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "uniqueItems": True,
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "default": [],
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "uniqueItems": True,
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "default": [],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 5d9c55675f3588198498ad76cd765969536ccd93..5f56ab929ead9f1fa2e60cacfa6ae3ed2c31b326 100644 (file)
@@ -1,5 +1,6 @@
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_operation_configuration.tutorial006_py39 import app
 
@@ -23,49 +24,51 @@ def test_query_params_str_validations(path, expected_status, expected_response):
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "tags": ["items"],
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                }
+    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": {}}},
+                            }
+                        },
+                        "tags": ["items"],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                    }
+                },
+                "/users/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "tags": ["users"],
+                        "summary": "Read Users",
+                        "operationId": "read_users_users__get",
+                    }
+                },
+                "/elements/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "tags": ["items"],
+                        "summary": "Read Elements",
+                        "operationId": "read_elements_elements__get",
+                        "deprecated": True,
+                    }
+                },
             },
-            "/users/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "tags": ["users"],
-                    "summary": "Read Users",
-                    "operationId": "read_users_users__get",
-                }
-            },
-            "/elements/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "tags": ["items"],
-                    "summary": "Read Elements",
-                    "operationId": "read_elements_elements__get",
-                    "deprecated": True,
-                }
-            },
-        },
-    }
+        }
+    )
index f54626f339ded4fe3d914c5278db9464e4713fe0..ec598832b06b09a98d4a9a0d770c43ef65ef20b2 100644 (file)
@@ -1,5 +1,6 @@
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_params.tutorial001_py39 import app
 
@@ -22,97 +23,99 @@ def test_get_items(item_id, expected_response):
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                },
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Read Item",
                     },
-                    "summary": "Read Item",
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 46da41b481a0204e82541fed9354585a2d0fd66b..8384ec8effb044b1c150ab7202a5dfacbbc1728d 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_params.tutorial002_py39 import app
 
@@ -29,98 +30,100 @@ def test_get_items_invalid_id():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "integer",
+                                },
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Read Item",
                     },
-                    "summary": "Read Item",
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 6ac92c87e337944507fa3a618d782ab1b94c7cce..432ccde49d27316354d20af0a2d16cc39b077ac5 100644 (file)
@@ -1,5 +1,6 @@
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_params.tutorial003_py39 import app
 
@@ -22,114 +23,116 @@ def test_get_users(user_id: str, expected_response: dict):
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "operationId": "read_user_me_users_me_get",
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "operationId": "read_user_me_users_me_get",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
                         },
+                        "summary": "Read User Me",
                     },
-                    "summary": "Read User Me",
                 },
-            },
-            "/users/{user_id}": {
-                "get": {
-                    "operationId": "read_user_users__user_id__get",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "user_id",
-                            "required": True,
-                            "schema": {
-                                "title": "User Id",
-                                "type": "string",
+                "/users/{user_id}": {
+                    "get": {
+                        "operationId": "read_user_users__user_id__get",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "user_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "User Id",
+                                    "type": "string",
+                                },
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Read User",
                     },
-                    "summary": "Read User",
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 8e4a26a1caddaff31362b9109efce6fc686a6c28..1cf39eca9a7ac2fb52df8cd3c19511eee851c762 100644 (file)
@@ -1,6 +1,7 @@
 import asyncio
 
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_params.tutorial003b_py39 import app, read_users2
 
@@ -20,25 +21,27 @@ def test_read_users2():  # Just for coverage
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users": {
-                "get": {
-                    "operationId": "read_users2_users_get",
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users": {
+                    "get": {
+                        "operationId": "read_users2_users_get",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
                         },
+                        "summary": "Read Users2",
                     },
-                    "summary": "Read Users2",
                 },
             },
-        },
-    }
+        }
+    )
index 8f460fb695f3679a8a7b7ee8c47b572426ca087e..b691e821df016bb284a8415757386fa51119ef37 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_params.tutorial004_py39 import app
 
@@ -22,72 +23,76 @@ def test_root_file_path():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/files/{file_path}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/files/{file_path}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read File",
-                    "operationId": "read_file_files__file_path__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "File Path", "type": "string"},
-                            "name": "file_path",
-                            "in": "path",
-                        }
-                    ],
+                        "summary": "Read File",
+                        "operationId": "read_file_files__file_path__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "File Path", "type": "string"},
+                                "name": "file_path",
+                                "in": "path",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 3e3766e845112e89d8b98939ea159cf3843fcaf5..c60fee3f0cc515fff91d55a1007bec2059848b21 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.path_params.tutorial005_py39 import app
 
@@ -42,78 +43,81 @@ def test_get_enums_invalid():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    data = response.json()
-    assert data == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/models/{model_name}": {
-                "get": {
-                    "summary": "Get Model",
-                    "operationId": "get_model_models__model_name__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"$ref": "#/components/schemas/ModelName"},
-                            "name": "model_name",
-                            "in": "path",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/models/{model_name}": {
+                    "get": {
+                        "summary": "Get Model",
+                        "operationId": "get_model_models__model_name__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"$ref": "#/components/schemas/ModelName"},
+                                "name": "model_name",
+                                "in": "path",
+                            }
+                        ],
+                        "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"},
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-                "ModelName": {
-                    "title": "ModelName",
-                    "enum": ["alexnet", "resnet", "lenet"],
-                    "type": "string",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ModelName": {
+                        "title": "ModelName",
+                        "enum": ["alexnet", "resnet", "lenet"],
+                        "type": "string",
+                    },
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index a4d68d01b42f96b19acc9277b6c0dc87a5802098..b43de7032561f246c826ef09daa4d987ae3d6eaa 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -53,114 +54,116 @@ def test_read_items_invalid_item_id(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "The ID of the item to get",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "The ID of the item to get",
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "null",
-                                    },
-                                ],
-                                "title": "Item-Query",
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "null",
+                                        },
+                                    ],
+                                    "title": "Item-Query",
+                                },
+                                "name": "item-query",
+                                "in": "query",
                             },
-                            "name": "item-query",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
-                                }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 37533bd2280422da2319b50631badfabfe02cf1e..1bb2a3ea8e78ad3ba0133f8c7dfbd7857d7ef6bb 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -66,107 +67,109 @@ def test_read_items_missing_q(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "The ID of the item to get",
-                                "type": "integer",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "The ID of the item to get",
+                                    "type": "integer",
+                                },
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {
-                                "type": "string",
-                                "title": "Q",
+                            {
+                                "required": True,
+                                "schema": {
+                                    "type": "string",
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
-                                }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index a9c111a59422b6758f064f6c08606e18a680dc55..37c16d295402f8dc10b198ca5f83660cfb50d2ec 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -80,108 +81,110 @@ def test_read_items_missing_q(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "The ID of the item to get",
-                                "type": "integer",
-                                "minimum": 1,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "The ID of the item to get",
+                                    "type": "integer",
+                                    "minimum": 1,
+                                },
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {
-                                "type": "string",
-                                "title": "Q",
+                            {
+                                "required": True,
+                                "schema": {
+                                    "type": "string",
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
-                                }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index e0e976d6f31e5bfa7babb09fa8c4b94224572491..0afc9dcbc926116d04bdc35c30370900e4973271 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -96,109 +97,111 @@ def test_read_items_missing_q(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "The ID of the item to get",
-                                "type": "integer",
-                                "exclusiveMinimum": 0,
-                                "maximum": 1000,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "The ID of the item to get",
+                                    "type": "integer",
+                                    "exclusiveMinimum": 0,
+                                    "maximum": 1000,
+                                },
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {
-                                "type": "string",
-                                "title": "Q",
+                            {
+                                "required": True,
+                                "schema": {
+                                    "type": "string",
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
-                                }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 2004ad1d2bab313ceffbb20fe65d5e50506e4bba..e0a9694c12648548fac24259bf1e876ed6583f45 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -104,120 +105,122 @@ def test_read_items_size_too_large(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "title": "The ID of the item to get",
-                                "type": "integer",
-                                "minimum": 0,
-                                "maximum": 1000,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "title": "The ID of the item to get",
+                                    "type": "integer",
+                                    "minimum": 0,
+                                    "maximum": 1000,
+                                },
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {
-                                "type": "string",
-                                "title": "Q",
+                            {
+                                "required": True,
+                                "schema": {
+                                    "type": "string",
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "in": "query",
-                            "name": "size",
-                            "required": True,
-                            "schema": {
-                                "exclusiveMaximum": 10.5,
-                                "exclusiveMinimum": 0,
-                                "title": "Size",
-                                "type": "number",
+                            {
+                                "in": "query",
+                                "name": "size",
+                                "required": True,
+                                "schema": {
+                                    "exclusiveMaximum": 10.5,
+                                    "exclusiveMinimum": 0,
+                                    "title": "Size",
+                                    "type": "number",
+                                },
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
-                                }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    }
+                                },
                             },
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index 84e4557272907095dcc66a0682b7e81f339b0f3d..40ada0e8e4e070a38e0ec9462e69cb599cdf326d 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -43,86 +44,90 @@ def test_read_user_item(client: TestClient, path, expected_json):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Skip",
-                                "type": "integer",
-                                "default": 0,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Skip",
+                                    "type": "integer",
+                                    "default": 0,
+                                },
+                                "name": "skip",
+                                "in": "query",
                             },
-                            "name": "skip",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Limit",
-                                "type": "integer",
-                                "default": 10,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Limit",
+                                    "type": "integer",
+                                    "default": 10,
+                                },
+                                "name": "limit",
+                                "in": "query",
                             },
-                            "name": "limit",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f725c80b323d3137df3e4ef3b3149adca7ee8c70..1da308a7e2f4b45c77714bf5b5e0a80a57d9fc10 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -42,88 +43,92 @@ def test_read_user_item(client: TestClient, path, expected_json):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Q",
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "null",
-                                    },
-                                ],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Q",
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "null",
+                                        },
+                                    ],
+                                },
+                                "name": "q",
+                                "in": "query",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 9f1f2e6e4cb113efcc45ab91231c87c6559005a7..9bb58ff9fe050d72925840da66ba0cad14327e07 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -53,98 +54,102 @@ def test_read_user_item(client: TestClient, path, expected_json):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "summary": "Read Item",
-                    "operationId": "read_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Q",
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "null",
-                                    },
-                                ],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "summary": "Read Item",
+                        "operationId": "read_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Short",
-                                "type": "boolean",
-                                "default": False,
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Q",
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "null",
+                                        },
+                                    ],
+                                },
+                                "name": "q",
+                                "in": "query",
                             },
-                            "name": "short",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Short",
+                                    "type": "boolean",
+                                    "default": False,
+                                },
+                                "name": "short",
+                                "in": "query",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index e834f973a91cebf08093ab02e6bb4ed73d7f7258..20aadb3acd7d003cfab63d090ae50ce45c7a2ceb 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -55,104 +56,108 @@ def test_read_user_item(client: TestClient, path, expected_json):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/{user_id}/items/{item_id}": {
-                "get": {
-                    "summary": "Read User Item",
-                    "operationId": "read_user_item_users__user_id__items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "User Id", "type": "integer"},
-                            "name": "user_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Q",
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "null",
-                                    },
-                                ],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/{user_id}/items/{item_id}": {
+                    "get": {
+                        "summary": "Read User Item",
+                        "operationId": "read_user_item_users__user_id__items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "User Id", "type": "integer"},
+                                "name": "user_id",
+                                "in": "path",
                             },
-                            "name": "q",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Short",
-                                "type": "boolean",
-                                "default": False,
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "short",
-                            "in": "query",
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Q",
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "null",
+                                        },
+                                    ],
+                                },
+                                "name": "q",
+                                "in": "query",
+                            },
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Short",
+                                    "type": "boolean",
+                                    "default": False,
+                                },
+                                "name": "short",
+                                "in": "query",
+                            },
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 36129dbc96cc34c641c2edc92893a9317301631a..e023fe6d806a011dfc36664088106a077572e94d 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.query_params.tutorial005_py39 import app
 
@@ -29,78 +30,82 @@ def test_foo_no_needy():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read User Item",
-                    "operationId": "read_user_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "Needy", "type": "string"},
-                            "name": "needy",
-                            "in": "query",
-                        },
-                    ],
+                        "summary": "Read User Item",
+                        "operationId": "read_user_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
+                            },
+                            {
+                                "required": True,
+                                "schema": {"title": "Needy", "type": "string"},
+                                "name": "needy",
+                                "in": "query",
+                            },
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 473dc33661a7210a7f5670c3a33ee4943e5d905f..b28e12655623b72ff7b47f047bcddbb91d6bda7b 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -61,97 +62,101 @@ def test_foo_no_needy(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read User Item",
-                    "operationId": "read_user_item_items__item_id__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "string"},
-                            "name": "item_id",
-                            "in": "path",
-                        },
-                        {
-                            "required": True,
-                            "schema": {"title": "Needy", "type": "string"},
-                            "name": "needy",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Skip",
-                                "type": "integer",
-                                "default": 0,
+                        "summary": "Read User Item",
+                        "operationId": "read_user_item_items__item_id__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "string"},
+                                "name": "item_id",
+                                "in": "path",
                             },
-                            "name": "skip",
-                            "in": "query",
-                        },
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [{"type": "integer"}, {"type": "null"}],
-                                "title": "Limit",
+                            {
+                                "required": True,
+                                "schema": {"title": "Needy", "type": "string"},
+                                "name": "needy",
+                                "in": "query",
                             },
-                            "name": "limit",
-                            "in": "query",
-                        },
-                    ],
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Skip",
+                                    "type": "integer",
+                                    "default": 0,
+                                },
+                                "name": "skip",
+                                "in": "query",
+                            },
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [{"type": "integer"}, {"type": "null"}],
+                                    "title": "Limit",
+                                },
+                                "name": "limit",
+                                "in": "query",
+                            },
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 069921629ebf664c5886a1b3c4843ee410293a0a..ed73b7329ef5e33c69348079004e8fd9f79d7fbf 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -46,78 +47,82 @@ def test_query_params_str_validations_q_query(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {"type": "string"},
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {"type": "string"},
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index a043b5b2e755d777f2cf0cdb087e727ee405fb1e..3eac1f2b36e22462bc5cd6213ed5097804045042 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -64,81 +65,85 @@ def test_query_params_str_validations_q_too_long(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "maxLength": 50,
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "maxLength": 50,
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 68c6e6174f85a5b47f66851fb2e743a95406087c..59d5160acb6ccf765638333d4de9648901c6cb6e 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -74,82 +75,86 @@ def test_query_params_str_validations_q_too_long(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "minLength": 3,
-                                        "maxLength": 50,
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "minLength": 3,
+                                            "maxLength": 50,
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 79538f952bd0951e121c75feb038a330487b0208..abf08c93282118cc997905056d80038506be2fbc 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -67,83 +68,87 @@ def test_query_params_str_validations_q_nonregexquery(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "minLength": 3,
-                                        "maxLength": 50,
-                                        "pattern": "^fixedquery$",
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "minLength": 3,
+                                            "maxLength": 50,
+                                            "pattern": "^fixedquery$",
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fafbd0a7d08ade1d1e81846471ebf8a6578f9d0e..7b5368abc4688bc997905d624ed3f0641189fd89 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -57,77 +58,81 @@ def test_query_params_str_validations_q_short(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "type": "string",
-                                "default": "fixedquery",
-                                "minLength": 3,
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "type": "string",
+                                    "default": "fixedquery",
+                                    "minLength": 3,
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 1d01492c668bdea9b22e3dda188e9b45021bcb8f..2c1df2c08fb563ceb7bd12096db8e41d324b40ab 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -63,76 +64,80 @@ def test_query_params_str_validations_q_fixedquery_too_short(client: TestClient)
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "type": "string",
-                                "minLength": 3,
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "type": "string",
+                                    "minLength": 3,
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index d31cb5036a264a86662a955b747a436732e7ce3a..3df9efa839d7755f3631a1445bf57549826e18c7 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -73,78 +74,82 @@ def test_query_params_str_validations_q_short(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {
-                                "anyOf": [
-                                    {"type": "string", "minLength": 3},
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {
+                                    "anyOf": [
+                                        {"type": "string", "minLength": 3},
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index e030902451e9f0d4adc8801d5a5cbb5a15fa3cfa..874002b1730c241eaf69006657e98a37a40a8722 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -58,81 +59,85 @@ def test_query_params_str_validations_q_fixedquery_too_short(client: TestClient)
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "minLength": 3,
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Query string",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "minLength": 3,
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Query string",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 186de5e062e0be05f8ee3983b7db6f9e82f82b24..b9613a17b8fb1915f0ff6fb52ccb0bd946e52c09 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -58,83 +59,87 @@ def test_query_params_str_validations_q_fixedquery_too_short(client: TestClient)
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "description": "Query string for the items to search in the database that have a good match",
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "minLength": 3,
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Query string",
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
                                 "description": "Query string for the items to search in the database that have a good match",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "minLength": 3,
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Query string",
+                                    "description": "Query string for the items to search in the database that have a good match",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index b242a75c90cc2fe186b7b79b44515236dc2892ad..d749d85f7a693f8682404b8ee6ddb320ebb87489 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -48,78 +49,82 @@ def test_query_params_str_validations_q_fixedquery(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "schema": {
-                                "anyOf": [
-                                    {"type": "string"},
-                                    {"type": "null"},
-                                ],
-                                "title": "Item-Query",
-                            },
-                            "required": False,
-                            "name": "item-query",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "schema": {
+                                    "anyOf": [
+                                        {"type": "string"},
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Item-Query",
+                                },
+                                "required": False,
+                                "name": "item-query",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6a39130af24b4c3bb8db91d8290044335e305fe5..395f795184dde87b8859f87b7853210b7c030c58 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from fastapi._compat import PYDANTIC_VERSION_MINOR_TUPLE
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -65,92 +66,96 @@ def test_query_params_str_validations_item_query_nonregexquery(client: TestClien
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "description": "Query string for the items to search in the database that have a good match",
-                            "required": False,
-                            "deprecated": True,
-                            "schema": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "minLength": 3,
-                                        "maxLength": 50,
-                                        "pattern": "^fixedquery$",
-                                    },
-                                    {"type": "null"},
-                                ],
-                                "title": "Query string",
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
                                 "description": "Query string for the items to search in the database that have a good match",
-                                # See https://github.com/pydantic/pydantic/blob/80353c29a824c55dea4667b328ba8f329879ac9f/tests/test_fastapi.sh#L25-L34.
-                                **(
-                                    {"deprecated": True}
-                                    if PYDANTIC_VERSION_MINOR_TUPLE >= (2, 10)
-                                    else {}
-                                ),
-                            },
-                            "name": "item-query",
-                            "in": "query",
-                        }
-                    ],
+                                "required": False,
+                                "deprecated": True,
+                                "schema": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                            "minLength": 3,
+                                            "maxLength": 50,
+                                            "pattern": "^fixedquery$",
+                                        },
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Query string",
+                                    "description": "Query string for the items to search in the database that have a good match",
+                                    # See https://github.com/pydantic/pydantic/blob/80353c29a824c55dea4667b328ba8f329879ac9f/tests/test_fastapi.sh#L25-L34.
+                                    **(
+                                        {"deprecated": True}
+                                        if PYDANTIC_VERSION_MINOR_TUPLE >= (2, 10)
+                                        else {}
+                                    ),
+                                },
+                                "name": "item-query",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6ab279bf3e44d64a2962b62e0a8e0efd84c4094c..c25357fdd1312a9e16a01a5036ac9aaa64ecf38f 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -41,78 +42,82 @@ def test_query_no_values(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "anyOf": [
-                                    {"type": "array", "items": {"type": "string"}},
-                                    {"type": "null"},
-                                ],
-                                "title": "Q",
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "anyOf": [
+                                        {"type": "array", "items": {"type": "string"}},
+                                        {"type": "null"},
+                                    ],
+                                    "title": "Q",
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 41bfeb3a7aa73c3bb73a26e03fabf14f162a5570..c3d01e90eae15ba63e779f0db048653029b5e503 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -37,77 +38,81 @@ def test_multi_query_values(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Q",
-                                "type": "array",
-                                "items": {"type": "string"},
-                                "default": ["foo", "bar"],
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Q",
+                                    "type": "array",
+                                    "items": {"type": "string"},
+                                    "default": ["foo", "bar"],
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 52c8147ffb7eb38fb24e1771e695f31e64c0bfac..74efa4695856638f4d487a088c58ea107d83f6c5 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -37,77 +38,81 @@ def test_query_no_values(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    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": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Q",
-                                "type": "array",
-                                "items": {},
-                                "default": [],
-                            },
-                            "name": "q",
-                            "in": "query",
-                        }
-                    ],
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Q",
+                                    "type": "array",
+                                    "items": {},
+                                    "default": [],
+                                },
+                                "name": "q",
+                                "in": "query",
+                            }
+                        ],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index bb168f0fc386d65242b2edec1089033ae3ffb85f..6dff18b7877eb211d8abadae337d77640f990a05 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -39,64 +40,68 @@ def test_no_hidden_query(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index db9b83b31a0350a8ee792f762a83a02beeb7661c..fd5c3b0559d7a0336a12d5246772fa7562c719e0 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -82,122 +83,134 @@ def test_post_upload_file(tmp_path, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/files/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/files/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create File",
+                        "operationId": "create_file_files__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_file_files__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create File",
-                    "operationId": "create_file_files__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_file_files__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                }
-            },
-            "/uploadfile/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/uploadfile/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Upload File",
+                        "operationId": "create_upload_file_uploadfile__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_upload_file_uploadfile__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Upload File",
-                    "operationId": "create_upload_file_uploadfile__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_upload_file_uploadfile__post"
-                                }
+                    }
+                },
+            },
+            "components": {
+                "schemas": {
+                    "Body_create_upload_file_uploadfile__post": {
+                        "title": "Body_create_upload_file_uploadfile__post",
+                        "required": ["file"],
+                        "type": "object",
+                        "properties": {
+                            "file": {
+                                "title": "File",
+                                "type": "string",
+                                "format": "binary",
                             }
                         },
-                        "required": True,
-                    },
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "Body_create_upload_file_uploadfile__post": {
-                    "title": "Body_create_upload_file_uploadfile__post",
-                    "required": ["file"],
-                    "type": "object",
-                    "properties": {
-                        "file": {"title": "File", "type": "string", "format": "binary"}
                     },
-                },
-                "Body_create_file_files__post": {
-                    "title": "Body_create_file_files__post",
-                    "required": ["file"],
-                    "type": "object",
-                    "properties": {
-                        "file": {"title": "File", "type": "string", "format": "binary"}
+                    "Body_create_file_files__post": {
+                        "title": "Body_create_file_files__post",
+                        "required": ["file"],
+                        "type": "object",
+                        "properties": {
+                            "file": {
+                                "title": "File",
+                                "type": "string",
+                                "format": "binary",
+                            }
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 903452ac769db9c904ece7077e1a039c42f19ae9..5ef8df178c8c8fe42169e880082de6bf7044e9b9 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -41,132 +42,136 @@ def test_post_upload_file(tmp_path, client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/files/": {
-                "post": {
-                    "summary": "Create File",
-                    "operationId": "create_file_files__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_file_files__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/files/": {
+                    "post": {
+                        "summary": "Create File",
+                        "operationId": "create_file_files__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_file_files__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/uploadfile/": {
-                "post": {
-                    "summary": "Create Upload File",
-                    "operationId": "create_upload_file_uploadfile__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_upload_file_uploadfile__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/uploadfile/": {
+                    "post": {
+                        "summary": "Create Upload File",
+                        "operationId": "create_upload_file_uploadfile__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_upload_file_uploadfile__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_file_files__post": {
-                    "title": "Body_create_file_files__post",
-                    "required": ["file"],
-                    "type": "object",
-                    "properties": {
-                        "file": {
-                            "title": "File",
-                            "type": "string",
-                            "description": "A file read as bytes",
-                            "format": "binary",
-                        }
+            "components": {
+                "schemas": {
+                    "Body_create_file_files__post": {
+                        "title": "Body_create_file_files__post",
+                        "required": ["file"],
+                        "type": "object",
+                        "properties": {
+                            "file": {
+                                "title": "File",
+                                "type": "string",
+                                "description": "A file read as bytes",
+                                "format": "binary",
+                            }
+                        },
                     },
-                },
-                "Body_create_upload_file_uploadfile__post": {
-                    "title": "Body_create_upload_file_uploadfile__post",
-                    "required": ["file"],
-                    "type": "object",
-                    "properties": {
-                        "file": {
-                            "title": "File",
-                            "type": "string",
-                            "description": "A file read as UploadFile",
-                            "format": "binary",
-                        }
+                    "Body_create_upload_file_uploadfile__post": {
+                        "title": "Body_create_upload_file_uploadfile__post",
+                        "required": ["file"],
+                        "type": "object",
+                        "properties": {
+                            "file": {
+                                "title": "File",
+                                "type": "string",
+                                "description": "A file read as UploadFile",
+                                "format": "binary",
+                            }
+                        },
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 4d9ff0e93dd67f66c88f637d6e1a6d547c65d599..52655fd63b38b4c4acd70ffaf696709d65592c20 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -102,142 +103,146 @@ def test_get_root(app: FastAPI):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/files/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/files/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Files",
+                        "operationId": "create_files_files__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_files_files__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Files",
-                    "operationId": "create_files_files__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_files_files__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                }
-            },
-            "/uploadfiles/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                    }
+                },
+                "/uploadfiles/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create Upload Files",
+                        "operationId": "create_upload_files_uploadfiles__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_upload_files_uploadfiles__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create Upload Files",
-                    "operationId": "create_upload_files_uploadfiles__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_upload_files_uploadfiles__post"
-                                }
+                    }
+                },
+                "/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                }
-            },
-            "/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Main",
-                    "operationId": "main__get",
-                }
+                        "summary": "Main",
+                        "operationId": "main__get",
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_create_upload_files_uploadfiles__post": {
-                    "title": "Body_create_upload_files_uploadfiles__post",
-                    "required": ["files"],
-                    "type": "object",
-                    "properties": {
-                        "files": {
-                            "title": "Files",
-                            "type": "array",
-                            "items": {"type": "string", "format": "binary"},
-                        }
+            "components": {
+                "schemas": {
+                    "Body_create_upload_files_uploadfiles__post": {
+                        "title": "Body_create_upload_files_uploadfiles__post",
+                        "required": ["files"],
+                        "type": "object",
+                        "properties": {
+                            "files": {
+                                "title": "Files",
+                                "type": "array",
+                                "items": {"type": "string", "format": "binary"},
+                            }
+                        },
                     },
-                },
-                "Body_create_files_files__post": {
-                    "title": "Body_create_files_files__post",
-                    "required": ["files"],
-                    "type": "object",
-                    "properties": {
-                        "files": {
-                            "title": "Files",
-                            "type": "array",
-                            "items": {"type": "string", "format": "binary"},
-                        }
+                    "Body_create_files_files__post": {
+                        "title": "Body_create_files_files__post",
+                        "required": ["files"],
+                        "type": "object",
+                        "properties": {
+                            "files": {
+                                "title": "Files",
+                                "type": "array",
+                                "items": {"type": "string", "format": "binary"},
+                            }
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c9f7f09940927f4239c4fa9812d256ffdd1b4efb..a1425ba3307e77ea1a4ab1af889c7fb64447c3fa 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -72,144 +73,148 @@ def test_get_root(app: FastAPI):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/files/": {
-                "post": {
-                    "summary": "Create Files",
-                    "operationId": "create_files_files__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_files_files__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/files/": {
+                    "post": {
+                        "summary": "Create Files",
+                        "operationId": "create_files_files__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_files_files__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/uploadfiles/": {
-                "post": {
-                    "summary": "Create Upload Files",
-                    "operationId": "create_upload_files_uploadfiles__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_upload_files_uploadfiles__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                    }
+                },
+                "/uploadfiles/": {
+                    "post": {
+                        "summary": "Create Upload Files",
+                        "operationId": "create_upload_files_uploadfiles__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_upload_files_uploadfiles__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                }
-            },
-            "/": {
-                "get": {
-                    "summary": "Main",
-                    "operationId": "main__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                }
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
+                },
+                "/": {
+                    "get": {
+                        "summary": "Main",
+                        "operationId": "main__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_create_files_files__post": {
-                    "title": "Body_create_files_files__post",
-                    "required": ["files"],
-                    "type": "object",
-                    "properties": {
-                        "files": {
-                            "title": "Files",
-                            "type": "array",
-                            "items": {"type": "string", "format": "binary"},
-                            "description": "Multiple files as bytes",
-                        }
+            "components": {
+                "schemas": {
+                    "Body_create_files_files__post": {
+                        "title": "Body_create_files_files__post",
+                        "required": ["files"],
+                        "type": "object",
+                        "properties": {
+                            "files": {
+                                "title": "Files",
+                                "type": "array",
+                                "items": {"type": "string", "format": "binary"},
+                                "description": "Multiple files as bytes",
+                            }
+                        },
                     },
-                },
-                "Body_create_upload_files_uploadfiles__post": {
-                    "title": "Body_create_upload_files_uploadfiles__post",
-                    "required": ["files"],
-                    "type": "object",
-                    "properties": {
-                        "files": {
-                            "title": "Files",
-                            "type": "array",
-                            "items": {"type": "string", "format": "binary"},
-                            "description": "Multiple files as UploadFile",
-                        }
+                    "Body_create_upload_files_uploadfiles__post": {
+                        "title": "Body_create_upload_files_uploadfiles__post",
+                        "required": ["files"],
+                        "type": "object",
+                        "properties": {
+                            "files": {
+                                "title": "Files",
+                                "type": "array",
+                                "items": {"type": "string", "format": "binary"},
+                                "description": "Multiple files as UploadFile",
+                            }
+                        },
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c4740ee72da543121fcd950a2e01441da5a40888..68fa074dc39171af6a58d21c7cbad8e246f8175f 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -99,81 +100,85 @@ def test_post_body_json(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/login/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/login/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_login__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                "application/x-www-form-urlencoded": {
+                                    "schema": {"$ref": "#/components/schemas/FormData"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_login__post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {"$ref": "#/components/schemas/FormData"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "FormData": {
-                    "properties": {
-                        "username": {"type": "string", "title": "Username"},
-                        "password": {"type": "string", "title": "Password"},
+            },
+            "components": {
+                "schemas": {
+                    "FormData": {
+                        "properties": {
+                            "username": {"type": "string", "title": "Username"},
+                            "password": {"type": "string", "title": "Password"},
+                        },
+                        "type": "object",
+                        "required": ["username", "password"],
+                        "title": "FormData",
                     },
-                    "type": "object",
-                    "required": ["username", "password"],
-                    "title": "FormData",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index b07fce432a87836cf550a1e29d579959eaba7c65..ed5ae109a02533131e33f95fefa7822a7a38d9a0 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -116,82 +117,86 @@ def test_post_body_json(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/login/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/login/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_login__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                "application/x-www-form-urlencoded": {
+                                    "schema": {"$ref": "#/components/schemas/FormData"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_login__post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {"$ref": "#/components/schemas/FormData"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "FormData": {
-                    "properties": {
-                        "username": {"type": "string", "title": "Username"},
-                        "password": {"type": "string", "title": "Password"},
+            },
+            "components": {
+                "schemas": {
+                    "FormData": {
+                        "properties": {
+                            "username": {"type": "string", "title": "Username"},
+                            "password": {"type": "string", "title": "Password"},
+                        },
+                        "additionalProperties": False,
+                        "type": "object",
+                        "required": ["username", "password"],
+                        "title": "FormData",
                     },
-                    "additionalProperties": False,
-                    "type": "object",
-                    "required": ["username", "password"],
-                    "title": "FormData",
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index f5f76306e97d17af5758e8b6c66fa5272043f2e0..d1596f137e2c40f0e2e4ac364b8835d4530385d0 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -99,83 +100,87 @@ def test_post_body_json(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/login/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/login/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_login__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_login_login__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_login__post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_login_login__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Body_login_login__post": {
-                    "title": "Body_login_login__post",
-                    "required": ["username", "password"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {"title": "Password", "type": "string"},
+            },
+            "components": {
+                "schemas": {
+                    "Body_login_login__post": {
+                        "title": "Body_login_login__post",
+                        "required": ["username", "password"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {"title": "Password", "type": "string"},
+                        },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index cd05a1ccf1c604953552d5f2b495e7045a50857b..6e9165c425ffc9db085e8909d166e4b3fef70597 100644 (file)
@@ -3,6 +3,7 @@ import importlib
 import pytest
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -149,88 +150,96 @@ def test_post_files_and_token(tmp_path, app: FastAPI):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/files/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/files/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create File",
+                        "operationId": "create_file_files__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "multipart/form-data": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_create_file_files__post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create File",
-                    "operationId": "create_file_files__post",
-                    "requestBody": {
-                        "content": {
-                            "multipart/form-data": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_create_file_files__post"
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Body_create_file_files__post": {
-                    "title": "Body_create_file_files__post",
-                    "required": ["file", "fileb", "token"],
-                    "type": "object",
-                    "properties": {
-                        "file": {"title": "File", "type": "string", "format": "binary"},
-                        "fileb": {
-                            "title": "Fileb",
-                            "type": "string",
-                            "format": "binary",
+            },
+            "components": {
+                "schemas": {
+                    "Body_create_file_files__post": {
+                        "title": "Body_create_file_files__post",
+                        "required": ["file", "fileb", "token"],
+                        "type": "object",
+                        "properties": {
+                            "file": {
+                                "title": "File",
+                                "type": "string",
+                                "format": "binary",
+                            },
+                            "fileb": {
+                                "title": "Fileb",
+                                "type": "string",
+                                "format": "binary",
+                            },
+                            "token": {"title": "Token", "type": "string"},
                         },
-                        "token": {"title": "Token", "type": "string"},
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 76e7143bdaf13d5b2e640925e04b77a667c300c0..2b034f1c98225646657420fc3109c41ff80b58cd 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -40,115 +41,117 @@ def test_path_operation(client: TestClient):
 def test_openapi_schema_pv2(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/items/{id}": {
-                "put": {
-                    "operationId": "update_item_items__id__put",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "id",
-                            "required": True,
-                            "schema": {"title": "Id", "type": "string"},
-                        },
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                },
-                            },
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {"schema": {}},
+    assert response.json() == snapshot(
+        {
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/items/{id}": {
+                    "put": {
+                        "operationId": "update_item_items__id__put",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "id",
+                                "required": True,
+                                "schema": {"title": "Id", "type": "string"},
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                                        "$ref": "#/components/schemas/Item",
                                     },
                                 },
                             },
-                            "description": "Validation Error",
+                            "required": True,
                         },
-                    },
-                    "summary": "Update Item",
-                },
-            },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {"schema": {}},
+                                },
+                                "description": "Successful Response",
+                            },
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
+                                    },
+                                },
+                                "description": "Validation Error",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "summary": "Update Item",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
                 },
-                "Item": {
-                    "properties": {
-                        "description": {
-                            "anyOf": [
-                                {"type": "string"},
-                                {"type": "null"},
-                            ],
-                            "title": "Description",
-                        },
-                        "timestamp": {
-                            "format": "date-time",
-                            "title": "Timestamp",
-                            "type": "string",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
+                            },
                         },
-                        "title": {"title": "Title", "type": "string"},
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "title",
-                        "timestamp",
-                    ],
-                    "title": "Item",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
+                    "Item": {
+                        "properties": {
+                            "description": {
                                 "anyOf": [
                                     {"type": "string"},
-                                    {"type": "integer"},
+                                    {"type": "null"},
                                 ],
+                                "title": "Description",
                             },
-                            "title": "Location",
-                            "type": "array",
+                            "timestamp": {
+                                "format": "date-time",
+                                "title": "Timestamp",
+                                "type": "string",
+                            },
+                            "title": {"title": "Title", "type": "string"},
+                        },
+                        "required": [
+                            "title",
+                            "timestamp",
+                        ],
+                        "title": "Item",
+                        "type": "object",
+                    },
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {"type": "string"},
+                                        {"type": "integer"},
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index ef84575723b377245eea99f14b3745759994eb1e..047e82c148fb2342d910e8c5482f4ce17ccb6f8e 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -38,28 +39,30 @@ def test_path_operation(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/legacy/": {
-                "get": {
-                    "operationId": "get_legacy_data_legacy__get",
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+    assert response.json() == snapshot(
+        {
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/legacy/": {
+                    "get": {
+                        "operationId": "get_legacy_data_legacy__get",
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
                         },
+                        "summary": "Get Legacy Data",
                     },
-                    "summary": "Get Legacy Data",
                 },
             },
-        },
-    }
+        }
+    )
index 265162f15f5aa5aea1e0bb3d4b775c979f7b9f77..914f53783c16e51d77c9930c8df274c8af973fd1 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -77,119 +78,125 @@ def test_create_item_only_required(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "type": "array",
-                                        "items": {"$ref": "#/components/schemas/Item"},
-                                        "title": "Response Read Items Items  Get",
+    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": {
+                                            "type": "array",
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                            "title": "Response Read Items Items  Get",
+                                        }
                                     }
-                                }
-                            },
-                        },
-                    },
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                },
-                "post": {
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
                                 },
                             },
                         },
-                        "required": True,
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
+                    "post": {
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Item"},
-                                }
+                                    "schema": {
+                                        "$ref": "#/components/schemas/Item",
+                                    },
+                                },
                             },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Item"},
                                     }
-                                }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
                     },
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                },
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "price": {"title": "Price", "type": "number"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                        },
-                        "tags": {
-                            "title": "Tags",
-                            "type": "array",
-                            "items": {"type": "string"},
-                            "default": [],
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "price": {"title": "Price", "type": "number"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
+                            "tags": {
+                                "title": "Tags",
+                                "type": "array",
+                                "items": {"type": "string"},
+                                "default": [],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 17027d3c10253873c99a0fbcd9087a5f2e96db0f..10a4e37cd3575e3478cb844f0035665a0c5264a9 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -38,94 +39,100 @@ def test_post_user(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/user/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/UserIn"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/user/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/UserIn"
+                                        }
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Create User",
+                        "operationId": "create_user_user__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/UserIn"}
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Create User",
-                    "operationId": "create_user_user__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/UserIn"}
-                            }
-                        },
-                        "required": True,
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "UserIn": {
-                    "title": "UserIn",
-                    "required": ["username", "password", "email"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {"title": "Password", "type": "string"},
-                        "email": {
-                            "title": "Email",
-                            "type": "string",
-                            "format": "email",
-                        },
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "UserIn": {
+                        "title": "UserIn",
+                        "required": ["username", "password", "email"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {"title": "Password", "type": "string"},
+                            "email": {
+                                "title": "Email",
+                                "type": "string",
+                                "format": "email",
+                            },
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index fcd5f9a1d48b9c07f0505daadcd3b971c5640f63..460c882516b0b76679c554a8f7d682ad4a0ac93e 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.response_model.tutorial003_02_py39 import app
 
@@ -20,76 +21,80 @@ def test_get_redirect():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/portal": {
-                "get": {
-                    "summary": "Get Portal",
-                    "operationId": "get_portal_portal_get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Teleport",
-                                "type": "boolean",
-                                "default": False,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/portal": {
+                    "get": {
+                        "summary": "Get Portal",
+                        "operationId": "get_portal_portal_get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Teleport",
+                                    "type": "boolean",
+                                    "default": False,
+                                },
+                                "name": "teleport",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                            "name": "teleport",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index ea3c733b249ef437a99b9fcf09c12b0cba1b12ad..c83d78c4fac9d402b8dd04b680d03960f0bbf758 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.response_model.tutorial003_03_py39 import app
 
@@ -14,21 +15,23 @@ def test_get_portal():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/teleport": {
-                "get": {
-                    "summary": "Get Teleport",
-                    "operationId": "get_teleport_teleport_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/teleport": {
+                    "get": {
+                        "summary": "Get Teleport",
+                        "operationId": "get_teleport_teleport_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index e64ed1a8045e6e1f8ffcc4367c4425ef400e07f6..187b6491fce7e4a1630327eea345ec3758621823 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -35,76 +36,80 @@ def test_get_redirect(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/portal": {
-                "get": {
-                    "summary": "Get Portal",
-                    "operationId": "get_portal_portal_get",
-                    "parameters": [
-                        {
-                            "required": False,
-                            "schema": {
-                                "title": "Teleport",
-                                "type": "boolean",
-                                "default": False,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/portal": {
+                    "get": {
+                        "summary": "Get Portal",
+                        "operationId": "get_portal_portal_get",
+                        "parameters": [
+                            {
+                                "required": False,
+                                "schema": {
+                                    "title": "Teleport",
+                                    "type": "boolean",
+                                    "default": False,
+                                },
+                                "name": "teleport",
+                                "in": "query",
+                            }
+                        ],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             },
-                            "name": "teleport",
-                            "in": "query",
-                        }
-                    ],
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                            "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"},
-                        }
+            },
+            "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"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 8b6213e33d61d4be7224c4a7dc3f2858d43a49d3..7199ceed656f896c882384115a2c78ee66b37c0d 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -27,72 +28,76 @@ def test_create_item(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "parameters": [
-                        {
-                            "name": "name",
-                            "in": "query",
-                            "required": True,
-                            "schema": {"title": "Name", "type": "string"},
-                        }
-                    ],
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "responses": {
-                        "201": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "parameters": [
+                            {
+                                "name": "name",
+                                "in": "query",
+                                "required": True,
+                                "schema": {"title": "Name", "type": "string"},
+                            }
+                        ],
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "responses": {
+                            "201": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
                                     }
-                                }
+                                },
                             },
                         },
-                    },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+            },
+            "components": {
+                "schemas": {
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 7f0105a26d356bc7f4c355d10b31aaf5133c65cc..f19346a3a491360d2d7e47b7a3e78a2b8bc734a1 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -36,106 +37,109 @@ def test_post_body_example(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    # insert_assert(response.json())
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "name": "item_id",
-                            "in": "path",
-                            "required": True,
-                            "schema": {"type": "integer", "title": "Item Id"},
-                        }
-                    ],
-                    "requestBody": {
-                        "required": True,
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "name": "item_id",
+                                "in": "path",
+                                "required": True,
+                                "schema": {"type": "integer", "title": "Item Id"},
                             }
-                        },
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        ],
+                        "requestBody": {
+                            "required": True,
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
                         },
-                    },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
-                    },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
                         },
-                        "price": {"type": "number", "title": "Price"},
-                        "tax": {
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                            "title": "Tax",
+                        "type": "object",
+                        "title": "HTTPValidationError",
+                    },
+                    "Item": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
+                            "price": {"type": "number", "title": "Price"},
+                            "tax": {
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                                "title": "Tax",
+                            },
                         },
+                        "type": "object",
+                        "required": ["name", "price"],
+                        "title": "Item",
+                        "examples": [
+                            {
+                                "description": "A very nice Item",
+                                "name": "Foo",
+                                "price": 35.4,
+                                "tax": 3.2,
+                            }
+                        ],
                     },
-                    "type": "object",
-                    "required": ["name", "price"],
-                    "title": "Item",
-                    "examples": [
-                        {
-                            "description": "A very nice Item",
-                            "name": "Foo",
-                            "price": 35.4,
-                            "tax": 3.2,
-                        }
-                    ],
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 32707c2993c233886c8e46a89521e36ac50edbef..8313cb14f6967553ea62c87f809e3b34f092e306 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -36,108 +37,111 @@ def test_post_body_example(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    # insert_assert(response.json())
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "name": "item_id",
-                            "in": "path",
-                            "required": True,
-                            "schema": {"type": "integer", "title": "Item Id"},
-                        }
-                    ],
-                    "requestBody": {
-                        "required": True,
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "name": "item_id",
+                                "in": "path",
+                                "required": True,
+                                "schema": {"type": "integer", "title": "Item Id"},
                             }
-                        },
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        ],
+                        "requestBody": {
+                            "required": True,
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
                         },
-                    },
-                }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
-                    },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {
-                            "type": "string",
-                            "title": "Name",
-                            "examples": ["Foo"],
-                        },
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
-                            "examples": ["A very nice Item"],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "price": {
-                            "type": "number",
-                            "title": "Price",
-                            "examples": [35.4],
+                    }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
                         },
-                        "tax": {
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                            "title": "Tax",
-                            "examples": [3.2],
+                        "type": "object",
+                        "title": "HTTPValidationError",
+                    },
+                    "Item": {
+                        "properties": {
+                            "name": {
+                                "type": "string",
+                                "title": "Name",
+                                "examples": ["Foo"],
+                            },
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                                "examples": ["A very nice Item"],
+                            },
+                            "price": {
+                                "type": "number",
+                                "title": "Price",
+                                "examples": [35.4],
+                            },
+                            "tax": {
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                                "title": "Tax",
+                                "examples": [3.2],
+                            },
                         },
+                        "type": "object",
+                        "required": ["name", "price"],
+                        "title": "Item",
                     },
-                    "type": "object",
-                    "required": ["name", "price"],
-                    "title": "Item",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 4f8f1394c13afbaf7e9f692b9f5d00d837e4c930..3c45a64bcf5af14150e7e32e97644107d84e13e0 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -38,108 +39,111 @@ def test_post_body_example(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    # insert_assert(response.json())
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "name": "item_id",
-                            "in": "path",
-                            "required": True,
-                            "schema": {"type": "integer", "title": "Item Id"},
-                        }
-                    ],
-                    "requestBody": {
-                        "required": True,
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                    "examples": [
-                                        {
-                                            "description": "A very nice Item",
-                                            "name": "Foo",
-                                            "price": 35.4,
-                                            "tax": 3.2,
-                                        }
-                                    ],
-                                },
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "name": "item_id",
+                                "in": "path",
+                                "required": True,
+                                "schema": {"type": "integer", "title": "Item Id"},
                             }
-                        },
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        ],
+                        "requestBody": {
+                            "required": True,
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                        "$ref": "#/components/schemas/Item",
+                                        "examples": [
+                                            {
+                                                "description": "A very nice Item",
+                                                "name": "Foo",
+                                                "price": 35.4,
+                                                "tax": 3.2,
+                                            }
+                                        ],
+                                    },
                                 }
                             },
                         },
-                    },
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
-                    },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
                         },
-                        "price": {"type": "number", "title": "Price"},
-                        "tax": {
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
-                            "title": "Tax",
+                        "type": "object",
+                        "title": "HTTPValidationError",
+                    },
+                    "Item": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
+                            "price": {"type": "number", "title": "Price"},
+                            "tax": {
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                                "title": "Tax",
+                            },
                         },
+                        "type": "object",
+                        "required": ["name", "price"],
+                        "title": "Item",
                     },
-                    "type": "object",
-                    "required": ["name", "price"],
-                    "title": "Item",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 3a0a7704bfdfa8d80b2e3cd0d4f173a113d7c014..4b8e15fa19542b05ad040329a563137a62c018a2 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -38,112 +39,116 @@ def test_post_body_example(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Item",
-                                    "examples": [
-                                        {
-                                            "name": "Foo",
-                                            "description": "A very nice Item",
-                                            "price": 35.4,
-                                            "tax": 3.2,
-                                        },
-                                        {"name": "Bar", "price": "35.4"},
-                                        {
-                                            "name": "Baz",
-                                            "price": "thirty five point four",
-                                        },
-                                    ],
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
                             }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                        ],
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Item",
+                                        "examples": [
+                                            {
+                                                "name": "Foo",
+                                                "description": "A very nice Item",
+                                                "price": 35.4,
+                                                "tax": 3.2,
+                                            },
+                                            {"name": "Bar", "price": "35.4"},
+                                            {
+                                                "name": "Baz",
+                                                "price": "thirty five point four",
+                                            },
+                                        ],
                                     }
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
                         },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                    },
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index b10f25e26216200a4383abd3b16f293018f519c1..7f8e36df21ddbb58476b7808ed61c4188534f0d8 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -38,121 +39,125 @@ def test_post_body_example(client: TestClient):
 def test_openapi_schema(client: TestClient) -> None:
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/{item_id}": {
-                "put": {
-                    "summary": "Update Item",
-                    "operationId": "update_item_items__item_id__put",
-                    "parameters": [
-                        {
-                            "required": True,
-                            "schema": {"title": "Item Id", "type": "integer"},
-                            "name": "item_id",
-                            "in": "path",
-                        }
-                    ],
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"},
-                                "examples": {
-                                    "normal": {
-                                        "summary": "A normal example",
-                                        "description": "A **normal** item works correctly.",
-                                        "value": {
-                                            "name": "Foo",
-                                            "description": "A very nice Item",
-                                            "price": 35.4,
-                                            "tax": 3.2,
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/{item_id}": {
+                    "put": {
+                        "summary": "Update Item",
+                        "operationId": "update_item_items__item_id__put",
+                        "parameters": [
+                            {
+                                "required": True,
+                                "schema": {"title": "Item Id", "type": "integer"},
+                                "name": "item_id",
+                                "in": "path",
+                            }
+                        ],
+                        "requestBody": {
+                            "content": {
+                                "application/json": {
+                                    "schema": {"$ref": "#/components/schemas/Item"},
+                                    "examples": {
+                                        "normal": {
+                                            "summary": "A normal example",
+                                            "description": "A **normal** item works correctly.",
+                                            "value": {
+                                                "name": "Foo",
+                                                "description": "A very nice Item",
+                                                "price": 35.4,
+                                                "tax": 3.2,
+                                            },
                                         },
-                                    },
-                                    "converted": {
-                                        "summary": "An example with converted data",
-                                        "description": "FastAPI can convert price `strings` to actual `numbers` automatically",
-                                        "value": {"name": "Bar", "price": "35.4"},
-                                    },
-                                    "invalid": {
-                                        "summary": "Invalid data is rejected with an error",
-                                        "value": {
-                                            "name": "Baz",
-                                            "price": "thirty five point four",
+                                        "converted": {
+                                            "summary": "An example with converted data",
+                                            "description": "FastAPI can convert price `strings` to actual `numbers` automatically",
+                                            "value": {"name": "Bar", "price": "35.4"},
+                                        },
+                                        "invalid": {
+                                            "summary": "Invalid data is rejected with an error",
+                                            "value": {
+                                                "name": "Baz",
+                                                "price": "thirty five point four",
+                                            },
                                         },
                                     },
-                                },
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+                                }
+                            },
+                            "required": True,
                         },
-                        "422": {
-                            "description": "Validation Error",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                        "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"},
-                        }
-                    },
-                },
-                "Item": {
-                    "title": "Item",
-                    "required": ["name", "price"],
-                    "type": "object",
-                    "properties": {
-                        "name": {"title": "Name", "type": "string"},
-                        "description": {
-                            "title": "Description",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
                         },
-                        "price": {"title": "Price", "type": "number"},
-                        "tax": {
-                            "title": "Tax",
-                            "anyOf": [{"type": "number"}, {"type": "null"}],
+                    },
+                    "Item": {
+                        "title": "Item",
+                        "required": ["name", "price"],
+                        "type": "object",
+                        "properties": {
+                            "name": {"title": "Name", "type": "string"},
+                            "description": {
+                                "title": "Description",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "price": {"title": "Price", "type": "number"},
+                            "tax": {
+                                "title": "Tax",
+                                "anyOf": [{"type": "number"}, {"type": "null"}],
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index cdaa50b191804582938c95aa9dee55a0e3f79aab..5742b51bf0fcf6fa7ca54742be420e09f40929e8 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -41,30 +42,32 @@ def test_incorrect_token(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "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": []}],
+    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"}},
+            },
+            "components": {
+                "securitySchemes": {
+                    "OAuth2PasswordBearer": {
+                        "type": "oauth2",
+                        "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 85c076b1d22a2bf41e39bc652c575daa213a100e..1e8c6e01808b92e1833274dd564bbbe3c455e5e8 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -42,30 +43,32 @@ def test_token(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Users Me",
-                    "operationId": "read_users_me_users_me_get",
-                    "security": [{"OAuth2PasswordBearer": []}],
-                }
-            }
-        },
-        "components": {
-            "securitySchemes": {
-                "OAuth2PasswordBearer": {
-                    "type": "oauth2",
-                    "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Users Me",
+                        "operationId": "read_users_me_users_me_get",
+                        "security": [{"OAuth2PasswordBearer": []}],
+                    }
                 }
             },
-        },
-    }
+            "components": {
+                "securitySchemes": {
+                    "OAuth2PasswordBearer": {
+                        "type": "oauth2",
+                        "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
+                    }
+                },
+            },
+        }
+    )
index 924b36b3abbb7009c7bee942f86498ac38709de2..acd910c71f3553437b04beef4e6aa06475c0066e 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -86,123 +87,131 @@ def test_inactive_user(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/token": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/token": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login",
+                        "operationId": "login_token_post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_login_token_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login",
-                    "operationId": "login_token_post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_login_token_post"
-                                }
+                    }
+                },
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
                             }
                         },
-                        "required": True,
-                    },
-                }
-            },
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Users Me",
-                    "operationId": "read_users_me_users_me_get",
-                    "security": [{"OAuth2PasswordBearer": []}],
-                }
+                        "summary": "Read Users Me",
+                        "operationId": "read_users_me_users_me_get",
+                        "security": [{"OAuth2PasswordBearer": []}],
+                    }
+                },
             },
-        },
-        "components": {
-            "schemas": {
-                "Body_login_token_post": {
-                    "title": "Body_login_token_post",
-                    "required": ["username", "password"],
-                    "type": "object",
-                    "properties": {
-                        "grant_type": {
-                            "title": "Grant Type",
-                            "anyOf": [
-                                {"pattern": "^password$", "type": "string"},
-                                {"type": "null"},
-                            ],
-                        },
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {
-                            "title": "Password",
-                            "type": "string",
-                            "format": "password",
-                        },
-                        "scope": {"title": "Scope", "type": "string", "default": ""},
-                        "client_id": {
-                            "title": "Client Id",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "client_secret": {
-                            "title": "Client Secret",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "format": "password",
+            "components": {
+                "schemas": {
+                    "Body_login_token_post": {
+                        "title": "Body_login_token_post",
+                        "required": ["username", "password"],
+                        "type": "object",
+                        "properties": {
+                            "grant_type": {
+                                "title": "Grant Type",
+                                "anyOf": [
+                                    {"pattern": "^password$", "type": "string"},
+                                    {"type": "null"},
+                                ],
+                            },
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {
+                                "title": "Password",
+                                "type": "string",
+                                "format": "password",
+                            },
+                            "scope": {
+                                "title": "Scope",
+                                "type": "string",
+                                "default": "",
+                            },
+                            "client_id": {
+                                "title": "Client Id",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "client_secret": {
+                                "title": "Client Secret",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "format": "password",
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
                 },
+                "securitySchemes": {
+                    "OAuth2PasswordBearer": {
+                        "type": "oauth2",
+                        "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
+                    }
+                },
             },
-            "securitySchemes": {
-                "OAuth2PasswordBearer": {
-                    "type": "oauth2",
-                    "flows": {"password": {"scopes": {}, "tokenUrl": "token"}},
-                }
-            },
-        },
-    }
+        }
+    )
index 2b0df66a2e507b03e2e1f3d6ee347c13c74294ba..e842c92a138b4eebfd7b7e6a4dbc8252e4bd76ab 100644 (file)
@@ -4,6 +4,7 @@ from unittest.mock import patch
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -188,178 +189,186 @@ def test_openapi_schema(mod: ModuleType):
     client = TestClient(mod.app)
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/token": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/Token"}
-                                }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/token": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/Token"}
+                                    }
+                                },
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
                             },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Login For Access Token",
+                        "operationId": "login_for_access_token_token_post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Body_login_for_access_token_token_post"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Login For Access Token",
-                    "operationId": "login_for_access_token_token_post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "$ref": "#/components/schemas/Body_login_for_access_token_token_post"
-                                }
+                    }
+                },
+                "/users/me/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {"$ref": "#/components/schemas/User"}
+                                    }
+                                },
                             }
                         },
-                        "required": True,
-                    },
-                }
+                        "summary": "Read Users Me",
+                        "operationId": "read_users_me_users_me__get",
+                        "security": [{"OAuth2PasswordBearer": []}],
+                    }
+                },
+                "/users/me/items/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Own Items",
+                        "operationId": "read_own_items_users_me_items__get",
+                        "security": [{"OAuth2PasswordBearer": []}],
+                    }
+                },
             },
-            "/users/me/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {"$ref": "#/components/schemas/User"}
-                                }
+            "components": {
+                "schemas": {
+                    "User": {
+                        "title": "User",
+                        "required": ["username"],
+                        "type": "object",
+                        "properties": {
+                            "username": {"title": "Username", "type": "string"},
+                            "email": {
+                                "title": "Email",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "full_name": {
+                                "title": "Full Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "disabled": {
+                                "title": "Disabled",
+                                "anyOf": [{"type": "boolean"}, {"type": "null"}],
                             },
-                        }
-                    },
-                    "summary": "Read Users Me",
-                    "operationId": "read_users_me_users_me__get",
-                    "security": [{"OAuth2PasswordBearer": []}],
-                }
-            },
-            "/users/me/items/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Own Items",
-                    "operationId": "read_own_items_users_me_items__get",
-                    "security": [{"OAuth2PasswordBearer": []}],
-                }
-            },
-        },
-        "components": {
-            "schemas": {
-                "User": {
-                    "title": "User",
-                    "required": ["username"],
-                    "type": "object",
-                    "properties": {
-                        "username": {"title": "Username", "type": "string"},
-                        "email": {
-                            "title": "Email",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "full_name": {
-                            "title": "Full Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        },
-                        "disabled": {
-                            "title": "Disabled",
-                            "anyOf": [{"type": "boolean"}, {"type": "null"}],
                         },
                     },
-                },
-                "Token": {
-                    "title": "Token",
-                    "required": ["access_token", "token_type"],
-                    "type": "object",
-                    "properties": {
-                        "access_token": {"title": "Access Token", "type": "string"},
-                        "token_type": {"title": "Token Type", "type": "string"},
-                    },
-                },
-                "Body_login_for_access_token_token_post": {
-                    "title": "Body_login_for_access_token_token_post",
-                    "required": ["username", "password"],
-                    "type": "object",
-                    "properties": {
-                        "grant_type": {
-                            "title": "Grant Type",
-                            "anyOf": [
-                                {"pattern": "^password$", "type": "string"},
-                                {"type": "null"},
-                            ],
-                        },
-                        "username": {"title": "Username", "type": "string"},
-                        "password": {
-                            "title": "Password",
-                            "type": "string",
-                            "format": "password",
-                        },
-                        "scope": {"title": "Scope", "type": "string", "default": ""},
-                        "client_id": {
-                            "title": "Client Id",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "Token": {
+                        "title": "Token",
+                        "required": ["access_token", "token_type"],
+                        "type": "object",
+                        "properties": {
+                            "access_token": {"title": "Access Token", "type": "string"},
+                            "token_type": {"title": "Token Type", "type": "string"},
                         },
-                        "client_secret": {
-                            "title": "Client Secret",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "format": "password",
+                    },
+                    "Body_login_for_access_token_token_post": {
+                        "title": "Body_login_for_access_token_token_post",
+                        "required": ["username", "password"],
+                        "type": "object",
+                        "properties": {
+                            "grant_type": {
+                                "title": "Grant Type",
+                                "anyOf": [
+                                    {"pattern": "^password$", "type": "string"},
+                                    {"type": "null"},
+                                ],
+                            },
+                            "username": {"title": "Username", "type": "string"},
+                            "password": {
+                                "title": "Password",
+                                "type": "string",
+                                "format": "password",
+                            },
+                            "scope": {
+                                "title": "Scope",
+                                "type": "string",
+                                "default": "",
+                            },
+                            "client_id": {
+                                "title": "Client Id",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "client_secret": {
+                                "title": "Client Secret",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "format": "password",
+                            },
                         },
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
                 },
+                "securitySchemes": {
+                    "OAuth2PasswordBearer": {
+                        "type": "oauth2",
+                        "flows": {
+                            "password": {
+                                "scopes": {},
+                                "tokenUrl": "token",
+                            }
+                        },
+                    }
+                },
             },
-            "securitySchemes": {
-                "OAuth2PasswordBearer": {
-                    "type": "oauth2",
-                    "flows": {
-                        "password": {
-                            "scopes": {},
-                            "tokenUrl": "token",
-                        }
-                    },
-                }
-            },
-        },
-    }
+        }
+    )
index a4b3104bbcbd04877713bbd5e4b21e3a5d193083..1c96f62ae3e352ee3c5c38a2e2ad7f8ceb66edb3 100644 (file)
@@ -3,6 +3,7 @@ from base64 import b64encode
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -53,25 +54,27 @@ def test_security_http_basic_non_basic_credentials(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBasic": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBasic": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
+            },
+        }
+    )
index 28b70a2d436c69875dd92c52cf174956ea1e647b..24667422fe8a0a2052bb9db2b8711f6f516d1fc5 100644 (file)
@@ -3,6 +3,7 @@ from base64 import b64encode
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(
@@ -65,25 +66,27 @@ def test_security_http_basic_invalid_password(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/users/me": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Current User",
-                    "operationId": "read_current_user_users_me_get",
-                    "security": [{"HTTPBasic": []}],
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/users/me": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Current User",
+                        "operationId": "read_current_user_users_me_get",
+                        "security": [{"HTTPBasic": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
-        },
-    }
+            },
+            "components": {
+                "securitySchemes": {"HTTPBasic": {"type": "http", "scheme": "basic"}}
+            },
+        }
+    )
index d0a0d5d388397adc25cea5aa6a0dfd35f297e887..0be3b59f9908ef9269e411acd778b0f355068e84 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -41,102 +42,108 @@ def test_read_items(client: TestClient) -> None:
 def test_openapi_schema(client: TestClient) -> None:
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "items": {"$ref": "#/components/schemas/Item"},
-                                        "type": "array",
-                                        "title": "Response Read Items Items  Get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                            "type": "array",
+                                            "title": "Response Read Items Items  Get",
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                },
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+                                },
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
+                    "Item": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
                         },
+                        "type": "object",
+                        "required": ["name"],
+                        "title": "Item",
                     },
-                    "type": "object",
-                    "required": ["name"],
-                    "title": "Item",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index a2fa56f93209a780a6551055ecb3d0c48de0038b..87c63f69e0b9a2f6c8dbc949b6c2ed8b90a31223 100644 (file)
@@ -2,6 +2,7 @@ import importlib
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from ...utils import needs_py310
 
@@ -41,102 +42,108 @@ def test_read_items(client: TestClient) -> None:
 def test_openapi_schema(client: TestClient) -> None:
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "get": {
-                    "summary": "Read Items",
-                    "operationId": "read_items_items__get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "items": {"$ref": "#/components/schemas/Item"},
-                                        "type": "array",
-                                        "title": "Response Read Items Items  Get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "get": {
+                        "summary": "Read Items",
+                        "operationId": "read_items_items__get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "items": {
+                                                "$ref": "#/components/schemas/Item"
+                                            },
+                                            "type": "array",
+                                            "title": "Response Read Items Items  Get",
+                                        }
                                     }
-                                }
-                            },
-                        }
-                    },
-                },
-                "post": {
-                    "summary": "Create Item",
-                    "operationId": "create_item_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Item"}
+                                },
                             }
                         },
-                        "required": True,
                     },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+                    "post": {
+                        "summary": "Create Item",
+                        "operationId": "create_item_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
-                                    }
+                                    "schema": {"$ref": "#/components/schemas/Item"}
                                 }
                             },
+                            "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": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Item": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "description": {
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                            "title": "Description",
+                    "Item": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "description": {
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                                "title": "Description",
+                            },
                         },
+                        "type": "object",
+                        "required": ["name"],
+                        "title": "Item",
                     },
-                    "type": "object",
-                    "required": ["name"],
-                    "title": "Item",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 0c5e440f1a0523d1f563e3dd6176996142fe8472..52b9b1e629e04df3bfa47f12ea3cfea0199faf77 100644 (file)
@@ -4,6 +4,7 @@ import sys
 import pytest
 from dirty_equals import IsAnyStr
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import ValidationError
 from pytest import MonkeyPatch
 
@@ -58,21 +59,23 @@ def test_app(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/info": {
-                "get": {
-                    "operationId": "info_info_get",
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Info",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/info": {
+                    "get": {
+                        "operationId": "info_info_get",
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Info",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 4fbf19ae82622ec1335be2cb21c96cec6cccb1b9..dd93fee790722bd8cfbc081dab05c0100750dac8 100644 (file)
@@ -3,6 +3,7 @@ from pathlib import Path
 
 import pytest
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 
 @pytest.fixture(scope="module")
@@ -33,8 +34,10 @@ def test_static_files_not_found(client: TestClient):
 def test_openapi_schema(client: TestClient):
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {},
-    }
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {},
+        }
+    )
index ef1f80164b082a58b70936982a5e86a11e57add4..a8fb3dc36fb0be448144c250d5704f5b0cbb884c 100644 (file)
@@ -1,53 +1,10 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.sub_applications.tutorial001_py39 import app
 
 client = TestClient(app)
 
-openapi_schema_main = {
-    "openapi": "3.1.0",
-    "info": {"title": "FastAPI", "version": "0.1.0"},
-    "paths": {
-        "/app": {
-            "get": {
-                "responses": {
-                    "200": {
-                        "description": "Successful Response",
-                        "content": {"application/json": {"schema": {}}},
-                    }
-                },
-                "summary": "Read Main",
-                "operationId": "read_main_app_get",
-            }
-        }
-    },
-}
-openapi_schema_sub = {
-    "openapi": "3.1.0",
-    "info": {"title": "FastAPI", "version": "0.1.0"},
-    "paths": {
-        "/sub": {
-            "get": {
-                "responses": {
-                    "200": {
-                        "description": "Successful Response",
-                        "content": {"application/json": {"schema": {}}},
-                    }
-                },
-                "summary": "Read Sub",
-                "operationId": "read_sub_sub_get",
-            }
-        }
-    },
-    "servers": [{"url": "/subapi"}],
-}
-
-
-def test_openapi_schema_main():
-    response = client.get("/openapi.json")
-    assert response.status_code == 200, response.text
-    assert response.json() == openapi_schema_main
-
 
 def test_main():
     response = client.get("/app")
@@ -55,13 +12,58 @@ def test_main():
     assert response.json() == {"message": "Hello World from main app"}
 
 
-def test_openapi_schema_sub():
-    response = client.get("/subapi/openapi.json")
-    assert response.status_code == 200, response.text
-    assert response.json() == openapi_schema_sub
-
-
 def test_sub():
     response = client.get("/subapi/sub")
     assert response.status_code == 200, response.text
     assert response.json() == {"message": "Hello World from sub API"}
+
+
+def test_openapi_schema_main():
+    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": {
+                "/app": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Main",
+                        "operationId": "read_main_app_get",
+                    }
+                }
+            },
+        }
+    )
+
+
+def test_openapi_schema_sub():
+    response = client.get("/subapi/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": {
+                "/sub": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Sub",
+                        "operationId": "read_sub_sub_get",
+                    }
+                }
+            },
+            "servers": [{"url": "/subapi"}],
+        }
+    )
index 9b3c796bdc416b3ebfa4a265cf4227130dab11f9..5284888053cb23322994dd2acb0ed1b543f52899 100644 (file)
@@ -1,3 +1,5 @@
+from inline_snapshot import snapshot
+
 from docs_src.app_testing.app_a_py39.test_main import client, test_read_main
 
 
@@ -8,21 +10,23 @@ def test_main():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Main",
-                    "operationId": "read_main__get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Main",
+                        "operationId": "read_main__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index 5f6533306efa181e6af844c0b4170c9a2ba35780..2b501d36a756c280bb530f3a7cf53e536393f33d 100644 (file)
@@ -1,3 +1,5 @@
+from inline_snapshot import snapshot
+
 from docs_src.app_testing.tutorial001_py39 import client, test_read_main
 
 
@@ -8,21 +10,23 @@ def test_main():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/": {
-                "get": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        }
-                    },
-                    "summary": "Read Main",
-                    "operationId": "read_main__get",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/": {
+                    "get": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            }
+                        },
+                        "summary": "Read Main",
+                        "operationId": "read_main__get",
+                    }
                 }
-            }
-        },
-    }
+            },
+        }
+    )
index b55bfb4567b46d7699c1bb86c70066e29df40f9f..cb8ae8b050a5b54374f9fa93fda53dbe66d5b02a 100644 (file)
@@ -1,4 +1,5 @@
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 
 from docs_src.using_request_directly.tutorial001_py39 import app
 
@@ -14,101 +15,103 @@ def test_path_operation():
 def test_openapi():
     response = client.get("/openapi.json")
     assert response.status_code == 200
-    assert response.json() == {
-        "info": {
-            "title": "FastAPI",
-            "version": "0.1.0",
-        },
-        "openapi": "3.1.0",
-        "paths": {
-            "/items/{item_id}": {
-                "get": {
-                    "operationId": "read_root_items__item_id__get",
-                    "parameters": [
-                        {
-                            "in": "path",
-                            "name": "item_id",
-                            "required": True,
-                            "schema": {
-                                "title": "Item Id",
-                                "type": "string",
+    assert response.json() == snapshot(
+        {
+            "info": {
+                "title": "FastAPI",
+                "version": "0.1.0",
+            },
+            "openapi": "3.1.0",
+            "paths": {
+                "/items/{item_id}": {
+                    "get": {
+                        "operationId": "read_root_items__item_id__get",
+                        "parameters": [
+                            {
+                                "in": "path",
+                                "name": "item_id",
+                                "required": True,
+                                "schema": {
+                                    "title": "Item Id",
+                                    "type": "string",
+                                },
                             },
-                        },
-                    ],
-                    "responses": {
-                        "200": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {},
+                        ],
+                        "responses": {
+                            "200": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {},
+                                    },
                                 },
+                                "description": "Successful Response",
                             },
-                            "description": "Successful Response",
-                        },
-                        "422": {
-                            "content": {
-                                "application/json": {
-                                    "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError",
+                            "422": {
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError",
+                                        },
                                     },
                                 },
+                                "description": "Validation Error",
                             },
-                            "description": "Validation Error",
                         },
+                        "summary": "Read Root",
                     },
-                    "summary": "Read Root",
                 },
             },
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {
-                                "$ref": "#/components/schemas/ValidationError",
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError",
+                                },
+                                "title": "Detail",
+                                "type": "array",
                             },
-                            "title": "Detail",
-                            "type": "array",
                         },
+                        "title": "HTTPValidationError",
+                        "type": "object",
                     },
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                    },
-                                    {
-                                        "type": "integer",
-                                    },
-                                ],
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [
+                                        {
+                                            "type": "string",
+                                        },
+                                        {
+                                            "type": "integer",
+                                        },
+                                    ],
+                                },
+                                "title": "Location",
+                                "type": "array",
+                            },
+                            "msg": {
+                                "title": "Message",
+                                "type": "string",
+                            },
+                            "type": {
+                                "title": "Error Type",
+                                "type": "string",
                             },
-                            "title": "Location",
-                            "type": "array",
-                        },
-                        "msg": {
-                            "title": "Message",
-                            "type": "string",
-                        },
-                        "type": {
-                            "title": "Error Type",
-                            "type": "string",
                         },
+                        "required": [
+                            "loc",
+                            "msg",
+                            "type",
+                        ],
+                        "title": "ValidationError",
+                        "type": "object",
                     },
-                    "required": [
-                        "loc",
-                        "msg",
-                        "type",
-                    ],
-                    "title": "ValidationError",
-                    "type": "object",
                 },
             },
-        },
-    }
+        }
+    )
index ee56bb6eb1bc1f352ab77f556edfa7e1bad48696..e333e2499fcf3c6bd92cfa145bb3322877c00f9e 100644 (file)
@@ -2,6 +2,7 @@ from typing import Optional, Union
 
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -38,94 +39,98 @@ def test_post_item():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Save Union Body",
+                        "operationId": "save_union_body_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Item",
+                                        "anyOf": [
+                                            {"$ref": "#/components/schemas/OtherItem"},
+                                            {"$ref": "#/components/schemas/Item"},
+                                        ],
                                     }
                                 }
                             },
+                            "required": True,
                         },
+                    }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "OtherItem": {
+                        "title": "OtherItem",
+                        "required": ["price"],
+                        "type": "object",
+                        "properties": {"price": {"title": "Price", "type": "integer"}},
                     },
-                    "summary": "Save Union Body",
-                    "operationId": "save_union_body_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Item",
-                                    "anyOf": [
-                                        {"$ref": "#/components/schemas/OtherItem"},
-                                        {"$ref": "#/components/schemas/Item"},
-                                    ],
-                                }
+                    "Item": {
+                        "title": "Item",
+                        "type": "object",
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
                             }
                         },
-                        "required": True,
                     },
-                }
-            }
-        },
-        "components": {
-            "schemas": {
-                "OtherItem": {
-                    "title": "OtherItem",
-                    "required": ["price"],
-                    "type": "object",
-                    "properties": {"price": {"title": "Price", "type": "integer"}},
-                },
-                "Item": {
-                    "title": "Item",
-                    "type": "object",
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        }
-                    },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index d90d0753a922cc78858cde0a0e17c73b1f574293..f6c2658f960afdf2b262ac8e1d9bcc2c871cb2e2 100644 (file)
@@ -2,6 +2,7 @@ from typing import Annotated, Union
 
 from fastapi import FastAPI, Form
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -61,97 +62,102 @@ def test_empty_form():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/form-union/": {
-                "post": {
-                    "summary": "Post Union Form",
-                    "operationId": "post_union_form_form_union__post",
-                    "requestBody": {
-                        "content": {
-                            "application/x-www-form-urlencoded": {
-                                "schema": {
-                                    "anyOf": [
-                                        {"$ref": "#/components/schemas/UserForm"},
-                                        {"$ref": "#/components/schemas/CompanyForm"},
-                                    ],
-                                    "title": "Data",
-                                }
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/form-union/": {
+                    "post": {
+                        "summary": "Post Union Form",
+                        "operationId": "post_union_form_form_union__post",
+                        "requestBody": {
                             "content": {
-                                "application/json": {
+                                "application/x-www-form-urlencoded": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "anyOf": [
+                                            {"$ref": "#/components/schemas/UserForm"},
+                                            {
+                                                "$ref": "#/components/schemas/CompanyForm"
+                                            },
+                                        ],
+                                        "title": "Data",
                                     }
                                 }
                             },
+                            "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": {
-                "CompanyForm": {
-                    "properties": {
-                        "company_name": {"type": "string", "title": "Company Name"},
-                        "industry": {"type": "string", "title": "Industry"},
+            },
+            "components": {
+                "schemas": {
+                    "CompanyForm": {
+                        "properties": {
+                            "company_name": {"type": "string", "title": "Company Name"},
+                            "industry": {"type": "string", "title": "Industry"},
+                        },
+                        "type": "object",
+                        "required": ["company_name", "industry"],
+                        "title": "CompanyForm",
                     },
-                    "type": "object",
-                    "required": ["company_name", "industry"],
-                    "title": "CompanyForm",
-                },
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "UserForm": {
-                    "properties": {
-                        "name": {"type": "string", "title": "Name"},
-                        "email": {"type": "string", "title": "Email"},
+                    "UserForm": {
+                        "properties": {
+                            "name": {"type": "string", "title": "Name"},
+                            "email": {"type": "string", "title": "Email"},
+                        },
+                        "type": "object",
+                        "required": ["name", "email"],
+                        "title": "UserForm",
                     },
-                    "type": "object",
-                    "required": ["name", "email"],
-                    "title": "UserForm",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index 6b284c68c3ebdcce9b3a6e0e27900beafcef9039..5378880a47224170507dd86415384900fb0cb02b 100644 (file)
@@ -2,6 +2,7 @@ from typing import Optional, Union
 
 from fastapi import FastAPI
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -38,100 +39,106 @@ def test_post_item():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {
-            "/items/": {
-                "post": {
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {
+                "/items/": {
+                    "post": {
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
                         },
-                        "422": {
-                            "description": "Validation Error",
+                        "summary": "Save Union Different Body",
+                        "operationId": "save_union_different_body_items__post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "title": "Item",
+                                        "anyOf": [
+                                            {
+                                                "$ref": "#/components/schemas/ExtendedItem"
+                                            },
+                                            {"$ref": "#/components/schemas/Item"},
+                                        ],
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "summary": "Save Union Different Body",
-                    "operationId": "save_union_different_body_items__post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {
-                                    "title": "Item",
-                                    "anyOf": [
-                                        {"$ref": "#/components/schemas/ExtendedItem"},
-                                        {"$ref": "#/components/schemas/Item"},
-                                    ],
-                                }
+                    }
+                }
+            },
+            "components": {
+                "schemas": {
+                    "Item": {
+                        "title": "Item",
+                        "type": "object",
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
                             }
                         },
-                        "required": True,
                     },
-                }
-            }
-        },
-        "components": {
-            "schemas": {
-                "Item": {
-                    "title": "Item",
-                    "type": "object",
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
-                        }
-                    },
-                },
-                "ExtendedItem": {
-                    "title": "ExtendedItem",
-                    "required": ["age"],
-                    "type": "object",
-                    "properties": {
-                        "name": {
-                            "title": "Name",
-                            "anyOf": [{"type": "string"}, {"type": "null"}],
+                    "ExtendedItem": {
+                        "title": "ExtendedItem",
+                        "required": ["age"],
+                        "type": "object",
+                        "properties": {
+                            "name": {
+                                "title": "Name",
+                                "anyOf": [{"type": "string"}, {"type": "null"}],
+                            },
+                            "age": {"title": "Age", "type": "integer"},
                         },
-                        "age": {"title": "Age", "type": "integer"},
                     },
-                },
-                "ValidationError": {
-                    "title": "ValidationError",
-                    "required": ["loc", "msg", "type"],
-                    "type": "object",
-                    "properties": {
-                        "loc": {
-                            "title": "Location",
-                            "type": "array",
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "title": "ValidationError",
+                        "required": ["loc", "msg", "type"],
+                        "type": "object",
+                        "properties": {
+                            "loc": {
+                                "title": "Location",
+                                "type": "array",
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
                             },
+                            "msg": {"title": "Message", "type": "string"},
+                            "type": {"title": "Error Type", "type": "string"},
+                            "input": {"title": "Input"},
+                            "ctx": {"title": "Context", "type": "object"},
                         },
-                        "msg": {"title": "Message", "type": "string"},
-                        "type": {"title": "Error Type", "type": "string"},
-                        "input": {"title": "Input"},
-                        "ctx": {"title": "Context", "type": "object"},
                     },
-                },
-                "HTTPValidationError": {
-                    "title": "HTTPValidationError",
-                    "type": "object",
-                    "properties": {
-                        "detail": {
-                            "title": "Detail",
-                            "type": "array",
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                        }
+                    "HTTPValidationError": {
+                        "title": "HTTPValidationError",
+                        "type": "object",
+                        "properties": {
+                            "detail": {
+                                "title": "Detail",
+                                "type": "array",
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                            }
+                        },
                     },
-                },
-            }
-        },
-    }
+                }
+            },
+        }
+    )
index c2c2809b2ff90b9d9af10cc78d63108417403c4d..267e450d12c5d92d46403807f793e566773fc154 100644 (file)
@@ -4,6 +4,7 @@ from typing import Annotated
 from fastapi import FastAPI, Security
 from fastapi.security import HTTPBearer
 from fastapi.testclient import TestClient
+from inline_snapshot import snapshot
 from pydantic import BaseModel
 
 app = FastAPI()
@@ -38,91 +39,96 @@ def test_dummy_webhook():
 def test_openapi_schema():
     response = client.get("/openapi.json")
     assert response.status_code == 200, response.text
-    # insert_assert(response.json())
-    assert response.json() == {
-        "openapi": "3.1.0",
-        "info": {"title": "FastAPI", "version": "0.1.0"},
-        "paths": {},
-        "webhooks": {
-            "new-subscription": {
-                "post": {
-                    "summary": "New Subscription",
-                    "description": "When a new user subscribes to your service we'll send you a POST request with this\ndata to the URL that you register for the event `new-subscription` in the dashboard.",
-                    "operationId": "new_subscriptionnew_subscription_post",
-                    "requestBody": {
-                        "content": {
-                            "application/json": {
-                                "schema": {"$ref": "#/components/schemas/Subscription"}
-                            }
-                        },
-                        "required": True,
-                    },
-                    "responses": {
-                        "200": {
-                            "description": "Successful Response",
-                            "content": {"application/json": {"schema": {}}},
-                        },
-                        "422": {
-                            "description": "Validation Error",
+    assert response.json() == snapshot(
+        {
+            "openapi": "3.1.0",
+            "info": {"title": "FastAPI", "version": "0.1.0"},
+            "paths": {},
+            "webhooks": {
+                "new-subscription": {
+                    "post": {
+                        "summary": "New Subscription",
+                        "description": "When a new user subscribes to your service we'll send you a POST request with this\ndata to the URL that you register for the event `new-subscription` in the dashboard.",
+                        "operationId": "new_subscriptionnew_subscription_post",
+                        "requestBody": {
                             "content": {
                                 "application/json": {
                                     "schema": {
-                                        "$ref": "#/components/schemas/HTTPValidationError"
+                                        "$ref": "#/components/schemas/Subscription"
                                     }
                                 }
                             },
+                            "required": True,
                         },
-                    },
-                    "security": [{"HTTPBearer": []}],
+                        "responses": {
+                            "200": {
+                                "description": "Successful Response",
+                                "content": {"application/json": {"schema": {}}},
+                            },
+                            "422": {
+                                "description": "Validation Error",
+                                "content": {
+                                    "application/json": {
+                                        "schema": {
+                                            "$ref": "#/components/schemas/HTTPValidationError"
+                                        }
+                                    }
+                                },
+                            },
+                        },
+                        "security": [{"HTTPBearer": []}],
+                    }
                 }
-            }
-        },
-        "components": {
-            "schemas": {
-                "HTTPValidationError": {
-                    "properties": {
-                        "detail": {
-                            "items": {"$ref": "#/components/schemas/ValidationError"},
-                            "type": "array",
-                            "title": "Detail",
-                        }
+            },
+            "components": {
+                "schemas": {
+                    "HTTPValidationError": {
+                        "properties": {
+                            "detail": {
+                                "items": {
+                                    "$ref": "#/components/schemas/ValidationError"
+                                },
+                                "type": "array",
+                                "title": "Detail",
+                            }
+                        },
+                        "type": "object",
+                        "title": "HTTPValidationError",
                     },
-                    "type": "object",
-                    "title": "HTTPValidationError",
-                },
-                "Subscription": {
-                    "properties": {
-                        "username": {"type": "string", "title": "Username"},
-                        "monthly_fee": {"type": "number", "title": "Monthly Fee"},
-                        "start_date": {
-                            "type": "string",
-                            "format": "date-time",
-                            "title": "Start Date",
+                    "Subscription": {
+                        "properties": {
+                            "username": {"type": "string", "title": "Username"},
+                            "monthly_fee": {"type": "number", "title": "Monthly Fee"},
+                            "start_date": {
+                                "type": "string",
+                                "format": "date-time",
+                                "title": "Start Date",
+                            },
                         },
+                        "type": "object",
+                        "required": ["username", "monthly_fee", "start_date"],
+                        "title": "Subscription",
                     },
-                    "type": "object",
-                    "required": ["username", "monthly_fee", "start_date"],
-                    "title": "Subscription",
-                },
-                "ValidationError": {
-                    "properties": {
-                        "ctx": {"title": "Context", "type": "object"},
-                        "input": {"title": "Input"},
-                        "loc": {
-                            "items": {
-                                "anyOf": [{"type": "string"}, {"type": "integer"}]
+                    "ValidationError": {
+                        "properties": {
+                            "ctx": {"title": "Context", "type": "object"},
+                            "input": {"title": "Input"},
+                            "loc": {
+                                "items": {
+                                    "anyOf": [{"type": "string"}, {"type": "integer"}]
+                                },
+                                "type": "array",
+                                "title": "Location",
                             },
-                            "type": "array",
-                            "title": "Location",
+                            "msg": {"type": "string", "title": "Message"},
+                            "type": {"type": "string", "title": "Error Type"},
                         },
-                        "msg": {"type": "string", "title": "Message"},
-                        "type": {"type": "string", "title": "Error Type"},
+                        "type": "object",
+                        "required": ["loc", "msg", "type"],
+                        "title": "ValidationError",
                     },
-                    "type": "object",
-                    "required": ["loc", "msg", "type"],
-                    "title": "ValidationError",
                 },
+                "securitySchemes": {"HTTPBearer": {"type": "http", "scheme": "bearer"}},
             },
-            "securitySchemes": {"HTTPBearer": {"type": "http", "scheme": "bearer"}},
-        },
-    }
+        }
+    )