Skip to content

Commit 23e0334

Browse files
authored
Stop strings in arbitrary type fields from automatically converting to UUID (#2274)
* stop strings from being upconverted to UUID if both are valid * add comment explaining
1 parent 97c7147 commit 23e0334

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

.generator/src/generator/templates/model_utils.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ COERCION_INDEX_BY_TYPE = {
572572
UPCONVERSION_TYPE_PAIRS = (
573573
(str, datetime),
574574
(str, date),
575-
(str, UUID),
575+
# (str, UUID), # Strings shouldn't always be converted to UUIDs, only when the format is a UUID explicitly.
576576
(int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float.
577577
(list, ModelComposed),
578578
(dict, ModelComposed),

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
entry: bash -c "SPHINX_APIDOC_OPTIONS=members,show-inheritance sphinx-apidoc --output-dir docs --force --no-toc --templatedir docs/_templates src/datadog_api_client *apis *models *version.py"
2828
pass_filenames: false
2929
additional_dependencies:
30-
- Sphinx
30+
- Sphinx==7.4.0
3131
- id: generator
3232
name: generator
3333
language: python

src/datadog_api_client/model_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def __eq__(self, other):
586586
UPCONVERSION_TYPE_PAIRS = (
587587
(str, datetime),
588588
(str, date),
589-
(str, UUID),
589+
# (str, UUID), # Strings shouldn't always be converted to UUIDs, only when the format is a UUID explicitly.
590590
(int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float.
591591
(list, ModelComposed),
592592
(dict, ModelComposed),

0 commit comments

Comments
 (0)