diff --git a/fingerprint_pro_server_api_sdk/api_client.py b/fingerprint_pro_server_api_sdk/api_client.py index 217022ca..3995165d 100644 --- a/fingerprint_pro_server_api_sdk/api_client.py +++ b/fingerprint_pro_server_api_sdk/api_client.py @@ -588,6 +588,8 @@ def __deserialize_model(data, klass): """ if not klass.swagger_types and not ApiClientDeserializer.__hasattr(klass, 'get_real_child_model'): + if hasattr(klass, '__parent_class__') and klass.__parent_class__ == 'dict': + return klass(**data) return data kwargs = {} diff --git a/fingerprint_pro_server_api_sdk/models/raw_device_attributes_result.py b/fingerprint_pro_server_api_sdk/models/raw_device_attributes_result.py index b72b20c3..a3e66f88 100644 --- a/fingerprint_pro_server_api_sdk/models/raw_device_attributes_result.py +++ b/fingerprint_pro_server_api_sdk/models/raw_device_attributes_result.py @@ -15,7 +15,7 @@ from fingerprint_pro_server_api_sdk.base_model import BaseModel -class RawDeviceAttributesResult(BaseModel): +class RawDeviceAttributesResult(dict): """ It includes 35+ raw browser identification attributes to provide Fingerprint users with even more information than our standard visitor ID provides. This enables Fingerprint users to not have to run our open-source product in conjunction with Fingerprint Pro Plus and Enterprise to get those additional attributes. Warning: The raw signals data can change at any moment as we improve the product. We cannot guarantee the internal shape of raw device attributes to be stable, so typical semantic versioning rules do not apply here. Use this data with caution without assuming a specific structure beyond the generic type provided here. @@ -36,7 +36,5 @@ class RawDeviceAttributesResult(BaseModel): attribute_map = { } - def __init__(self): # noqa: E501 - """RawDeviceAttributesResult - a model defined in Swagger""" # noqa: E501 - self.discriminator = None + __parent_class__ = 'dict' diff --git a/template/api_client.mustache b/template/api_client.mustache index b15f0c65..54f3abbe 100644 --- a/template/api_client.mustache +++ b/template/api_client.mustache @@ -580,6 +580,8 @@ class ApiClientDeserializer: """ if not klass.swagger_types and not ApiClientDeserializer.__hasattr(klass, 'get_real_child_model'): + if hasattr(klass, '__parent_class__') and klass.__parent_class__ == 'dict': + return klass(**data) return data kwargs = {} diff --git a/template/model.mustache b/template/model.mustache index 75fdb700..9863b16c 100644 --- a/template/model.mustache +++ b/template/model.mustache @@ -17,7 +17,7 @@ from datetime import datetime {{/vars}} -class {{classname}}(BaseModel): +class {{classname}}({{#parent}}{{parent}}{{/parent}}{{^parent}}BaseModel{{/parent}}): """{{#description}} {{{.}}} @@ -60,13 +60,19 @@ class {{classname}}(BaseModel): } {{/discriminator}} +{{#parent}} + __parent_class__ = '{{parent}}' +{{/parent}} +{{^parent}} def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501 - """{{classname}} - a model defined in Swagger""" # noqa: E501 + """{{classname}} - a model defined in Swagger""" # noqa: E501{{#parent}} + super().__init__(){{/parent}} {{#vars}}{{#@first}} {{/@first}} self._{{name}} = None {{/vars}} self.discriminator = {{#discriminator}}'{{discriminator}}'{{/discriminator}}{{^discriminator}}None{{/discriminator}} +{{/parent}} {{#vars}}{{#@first}} {{/@first}} {{#required}} diff --git a/test/test_fingerprint_api.py b/test/test_fingerprint_api.py index 91c86333..9b01dad0 100644 --- a/test/test_fingerprint_api.py +++ b/test/test_fingerprint_api.py @@ -18,7 +18,8 @@ from fingerprint_pro_server_api_sdk import (Configuration, TooManyRequestsResponse, ErrorVisits403, ErrorCommon403Response, ErrorEvent404Response, ErrorVisitor400Response, ErrorVisitor404Response, ErrorCommon429Response, EventUpdateRequest, - ErrorUpdateEvent400Response, ErrorUpdateEvent409Response) + ErrorUpdateEvent400Response, ErrorUpdateEvent409Response, + RawDeviceAttributesResult) from fingerprint_pro_server_api_sdk.api.fingerprint_api import FingerprintApi # noqa: E501 from fingerprint_pro_server_api_sdk.rest import KnownApiException, ApiException from urllib.parse import urlencode @@ -195,7 +196,8 @@ def test_get_event_correct_data(self): fields=[self.integration_info], headers=self.request_headers, preload_content=True, timeout=None) - self.api.get_event(mock_file1) + event_response = self.api.get_event(mock_file1) + self.assertIsInstance(event_response.products.raw_device_attributes.data, RawDeviceAttributesResult) def test_get_event_errors_200(self): """Test checks correct code run result in scenario of arrors in BotD or identification API"""