Skip to content

Commit 15ee362

Browse files
Merge pull request #98 from fingerprintjs/bugfix/INTER-1093-respect-nullable
fix: correctly serialize nullable fields
2 parents e20ea58 + 10b10e8 commit 15ee362

File tree

110 files changed

+657
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+657
-0
lines changed

.changeset/kind-walls-accept.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"fingerprint-pro-server-api-python-sdk": patch
3+
---
4+
5+
Correctly serialize nullable fields to `null`

.changeset/pre.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mode": "pre",
3+
"tag": "dev",
4+
"initialVersions": {
5+
"fingerprint-pro-server-api-python-sdk": "8.2.0"
6+
},
7+
"changesets": []
8+
}

fingerprint_pro_server_api_sdk/base_model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class BaseModel:
77

88
swagger_types: Dict[str, str] = {}
99
attribute_map: Dict[str, str] = {}
10+
nullable_map: Dict[str, bool] = {}
1011

1112
def to_dict(self) -> Dict[str, Union[list, dict]]:
1213
"""Returns the model properties as a dict"""
@@ -28,6 +29,9 @@ def to_dict(self) -> Dict[str, Union[list, dict]]:
2829
value.items()
2930
))
3031
elif value is None:
32+
if self.nullable_map[attr]:
33+
result[attr] = None
34+
3135
continue
3236
else:
3337
result[attr] = value

fingerprint_pro_server_api_sdk/models/botd.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ class Botd(BaseModel):
4444
'request_id': 'str'
4545
}
4646

47+
nullable_map = {
48+
'bot': False,
49+
'meta': False,
50+
'linked_id': False,
51+
'url': False,
52+
'ip': False,
53+
'time': False,
54+
'user_agent': False,
55+
'request_id': False
56+
}
57+
4758
attribute_map = {
4859
'bot': 'bot',
4960
'meta': 'meta',

fingerprint_pro_server_api_sdk/models/botd_bot.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ class BotdBot(BaseModel):
3636
'type': 'str'
3737
}
3838

39+
nullable_map = {
40+
'result': False,
41+
'type': False
42+
}
43+
3944
attribute_map = {
4045
'result': 'result',
4146
'type': 'type'

fingerprint_pro_server_api_sdk/models/botd_bot_result.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class BotdBotResult(BaseModel):
4040
swagger_types = {
4141
}
4242

43+
nullable_map = {
44+
}
45+
4346
attribute_map = {
4447
}
4548

fingerprint_pro_server_api_sdk/models/browser_details.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ class BrowserDetails(BaseModel):
3737
'user_agent': 'str'
3838
}
3939

40+
nullable_map = {
41+
'browser_name': False,
42+
'browser_major_version': False,
43+
'browser_full_version': False,
44+
'os': False,
45+
'os_version': False,
46+
'device': False,
47+
'user_agent': False
48+
}
49+
4050
attribute_map = {
4151
'browser_name': 'browserName',
4252
'browser_major_version': 'browserMajorVersion',

fingerprint_pro_server_api_sdk/models/cloned_app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class ClonedApp(BaseModel):
3131
'result': 'bool'
3232
}
3333

34+
nullable_map = {
35+
'result': False
36+
}
37+
3438
attribute_map = {
3539
'result': 'result'
3640
}

fingerprint_pro_server_api_sdk/models/deprecated_geolocation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ class DeprecatedGeolocation(BaseModel):
4646
'subdivisions': 'GeolocationSubdivisions'
4747
}
4848

49+
nullable_map = {
50+
'accuracy_radius': False,
51+
'latitude': False,
52+
'longitude': False,
53+
'postal_code': False,
54+
'timezone': False,
55+
'city': False,
56+
'country': False,
57+
'continent': False,
58+
'subdivisions': False
59+
}
60+
4961
attribute_map = {
5062
'accuracy_radius': 'accuracyRadius',
5163
'latitude': 'latitude',

fingerprint_pro_server_api_sdk/models/developer_tools.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ class DeveloperTools(BaseModel):
3131
'result': 'bool'
3232
}
3333

34+
nullable_map = {
35+
'result': False
36+
}
37+
3438
attribute_map = {
3539
'result': 'result'
3640
}

0 commit comments

Comments
 (0)