diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index f16453833c0b..2cd270355c3e 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -379,7 +379,6 @@ class ApiClient: # Convert attribute name to json key in # model definition for request. if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): - obj_dict = obj.to_dict() else: obj_dict = obj.__dict__ diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index 8aa3404b6a2d..d24d6d17a69a 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -411,8 +411,8 @@ def test_valdiator(self): class LoginTest(BaseModel): username: StrictStr = Field(min_length=2, strict=True, max_length=64) password: SecretStr - - l = LoginTest(username="admin", password="testing09876") + + l = LoginTest(username="admin", password=SecretStr("testing09876")) self.assertEqual(petstore_api.ApiClient().sanitize_for_serialization(l), {'username': "admin", 'password': "testing09876"}) def test_inline_enum_validator(self):