From 99d83712a8c64bdc0b47cb949efd35b99f41d0f6 Mon Sep 17 00:00:00 2001 From: fbl100 Date: Mon, 7 Dec 2020 15:18:16 -0500 Subject: [PATCH] Fixes issue #8014, _check_type flag not being honored. (#8053) * 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. * regenerated samples Co-authored-by: Frank Levine --- .../src/main/resources/python/model_utils.mustache | 6 ++++-- 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 ++++-- 5 files changed, 20 insertions(+), 10 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 9f3264e98ed..9c299d4b3ef 100644 --- a/modules/openapi-generator/src/main/resources/python/model_utils.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_utils.mustache @@ -1116,7 +1116,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: @@ -1136,7 +1137,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/client/petstore/python/petstore_api/model_utils.py b/samples/client/petstore/python/petstore_api/model_utils.py index ba607acda86..7afcb68f615 100644 --- a/samples/client/petstore/python/petstore_api/model_utils.py +++ b/samples/client/petstore/python/petstore_api/model_utils.py @@ -1398,7 +1398,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: @@ -1418,7 +1419,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 7acd69f3ca7..2533abbc717 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 @@ -1398,7 +1398,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: @@ -1418,7 +1419,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 48a70aeb472..f0a4962ad53 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 @@ -1398,7 +1398,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: @@ -1418,7 +1419,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 ba607acda86..7afcb68f615 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py +++ b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py @@ -1398,7 +1398,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: @@ -1418,7 +1419,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