From 1e1671689fa82171f10c9fadbfcddfdaaa252ba1 Mon Sep 17 00:00:00 2001 From: Frank Levine <frank.levine@gmail.com> Date: Tue, 17 Nov 2020 13:26:13 -0500 Subject: [PATCH 1/2] Fixes issue 8014, _check_type flag not being honored. Updated model_utils.mustache to pass the check_type flag into attempt_convert_item(). Failure to do so results in type validation errors occurring when the user has specifically requested that they be disabled. --- .../src/main/resources/python/model_utils.mustache | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/model_utils.mustache b/modules/openapi-generator/src/main/resources/python/model_utils.mustache index 1523dbc2d76..11b7b559756 100644 --- a/modules/openapi-generator/src/main/resources/python/model_utils.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_utils.mustache @@ -1118,7 +1118,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=True + must_convert=True, + check_type=_check_type ) return converted_instance else: @@ -1138,7 +1139,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=False + must_convert=False, + check_type=_check_type ) return converted_instance -- GitLab From ebb16e4b94c68a93b81599e44a6afd8a2a89150e Mon Sep 17 00:00:00 2001 From: Frank Levine <frank.levine@blacklynx.tech> Date: Tue, 1 Dec 2020 09:30:45 -0500 Subject: [PATCH 2/2] regenerated samples --- samples/client/petstore/python/petstore_api/model_utils.py | 6 ++++-- .../x-auth-id-alias/python/x_auth_id_alias/model_utils.py | 6 ++++-- .../dynamic-servers/python/dynamic_servers/model_utils.py | 6 ++++-- .../client/petstore/python/petstore_api/model_utils.py | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/samples/client/petstore/python/petstore_api/model_utils.py b/samples/client/petstore/python/petstore_api/model_utils.py index 79d14780d01..763a1962c0f 100644 --- a/samples/client/petstore/python/petstore_api/model_utils.py +++ b/samples/client/petstore/python/petstore_api/model_utils.py @@ -1400,7 +1400,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=True + must_convert=True, + check_type=_check_type ) return converted_instance else: @@ -1420,7 +1421,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=False + must_convert=False, + check_type=_check_type ) return converted_instance diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py index 850172ee120..293a4f8b29c 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py @@ -1400,7 +1400,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=True + must_convert=True, + check_type=_check_type ) return converted_instance else: @@ -1420,7 +1421,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=False + must_convert=False, + check_type=_check_type ) return converted_instance diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py index 8660af004f7..a21994c1a67 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py @@ -1400,7 +1400,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=True + must_convert=True, + check_type=_check_type ) return converted_instance else: @@ -1420,7 +1421,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=False + must_convert=False, + check_type=_check_type ) return converted_instance diff --git a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py index 79d14780d01..763a1962c0f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py @@ -1400,7 +1400,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=True + must_convert=True, + check_type=_check_type ) return converted_instance else: @@ -1420,7 +1421,8 @@ def validate_and_convert_types(input_value, required_types_mixed, path_to_item, configuration, spec_property_naming, key_type=False, - must_convert=False + must_convert=False, + check_type=_check_type ) return converted_instance -- GitLab