Skip to content

Commit c751c5a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Make assertion target be int or string (#2545)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 5b33374 commit c751c5a

10 files changed

+103
-88
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-05-20 07:21:28.312845",
8-
"spec_repo_commit": "fec20f97"
7+
"regenerated": "2025-05-23 12:48:25.197527",
8+
"spec_repo_commit": "11a9dcb4"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-05-20 07:21:28.331470",
13-
"spec_repo_commit": "fec20f97"
12+
"regenerated": "2025-05-23 12:48:25.223327",
13+
"spec_repo_commit": "11a9dcb4"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14221,8 +14221,8 @@ components:
1422114221
operator:
1422214222
$ref: '#/components/schemas/SyntheticsAssertionBodyHashOperator'
1422314223
target:
14224+
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
1422414225
description: Value used by the operator.
14225-
example: 123456
1422614226
type:
1422714227
$ref: '#/components/schemas/SyntheticsAssertionBodyHashType'
1422814228
required:
@@ -14278,6 +14278,7 @@ components:
1427814278
description: The specific operator to use on the path.
1427914279
type: string
1428014280
targetValue:
14281+
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
1428114282
description: The path target value to compare to.
1428214283
type: object
1428314284
SyntheticsAssertionJSONSchemaMetaSchema:
@@ -14385,8 +14386,8 @@ components:
1438514386
description: The associated assertion property.
1438614387
type: string
1438714388
target:
14389+
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
1438814390
description: Value used by the operator.
14389-
example: 123456
1439014391
timingsScope:
1439114392
$ref: '#/components/schemas/SyntheticsAssertionTimingsScope'
1439214393
type:
@@ -14396,6 +14397,20 @@ components:
1439614397
- operator
1439714398
- target
1439814399
type: object
14400+
SyntheticsAssertionTargetValue:
14401+
description: Value used by the operator in assertions. Can be either a number
14402+
or string.
14403+
oneOf:
14404+
- $ref: '#/components/schemas/SyntheticsAssertionTargetValueNumber'
14405+
- $ref: '#/components/schemas/SyntheticsAssertionTargetValueString'
14406+
SyntheticsAssertionTargetValueNumber:
14407+
description: Numeric value used by the operator in assertions.
14408+
format: double
14409+
type: number
14410+
SyntheticsAssertionTargetValueString:
14411+
description: String value used by the operator in assertions. Supports templated
14412+
variables.
14413+
type: string
1439914414
SyntheticsAssertionTimingsScope:
1440014415
description: Timings scope for response time assertions.
1440114416
enum:
@@ -14480,6 +14495,7 @@ components:
1448014495
description: The specific operator to use on the path.
1448114496
type: string
1448214497
targetValue:
14498+
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
1448314499
description: The path target value to compare to.
1448414500
xPath:
1448514501
description: The X path to assert.

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,6 +4078,13 @@ datadog\_api\_client.v1.model.synthetics\_assertion\_target module
40784078
:members:
40794079
:show-inheritance:
40804080

4081+
datadog\_api\_client.v1.model.synthetics\_assertion\_target\_value module
4082+
-------------------------------------------------------------------------
4083+
4084+
.. automodule:: datadog_api_client.v1.model.synthetics_assertion_target_value
4085+
:members:
4086+
:show-inheritance:
4087+
40814088
datadog\_api\_client.v1.model.synthetics\_assertion\_timings\_scope module
40824089
--------------------------------------------------------------------------
40834090

src/datadog_api_client/v1/model/synthetics_assertion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def __init__(self, **kwargs):
2222
:param _property: The associated assertion property.
2323
:type _property: str, optional
2424
25-
:param target: Value used by the operator.
26-
:type target: bool, date, datetime, dict, float, int, list, str, UUID, none_type
25+
:param target: Value used by the operator in assertions. Can be either a number or string.
26+
:type target: SyntheticsAssertionTargetValue
2727
2828
:param timings_scope: Timings scope for response time assertions.
2929
:type timings_scope: SyntheticsAssertionTimingsScope, optional

src/datadog_api_client/v1/model/synthetics_assertion_body_hash_target.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Any, TYPE_CHECKING
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11-
date,
12-
datetime,
13-
none_type,
14-
UUID,
1511
)
1612

1713

1814
if TYPE_CHECKING:
1915
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import SyntheticsAssertionBodyHashOperator
16+
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
2017
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType
2118

2219

@@ -26,22 +23,12 @@ def openapi_types(_):
2623
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import (
2724
SyntheticsAssertionBodyHashOperator,
2825
)
26+
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
2927
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType
3028

3129
return {
3230
"operator": (SyntheticsAssertionBodyHashOperator,),
33-
"target": (
34-
bool,
35-
date,
36-
datetime,
37-
dict,
38-
float,
39-
int,
40-
list,
41-
str,
42-
UUID,
43-
none_type,
44-
),
31+
"target": (SyntheticsAssertionTargetValue,),
4532
"type": (SyntheticsAssertionBodyHashType,),
4633
}
4734

@@ -54,7 +41,7 @@ def openapi_types(_):
5441
def __init__(
5542
self_,
5643
operator: SyntheticsAssertionBodyHashOperator,
57-
target: Any,
44+
target: Union[SyntheticsAssertionTargetValue, float, str],
5845
type: SyntheticsAssertionBodyHashType,
5946
**kwargs,
6047
):
@@ -64,8 +51,8 @@ def __init__(
6451
:param operator: Assertion operator to apply.
6552
:type operator: SyntheticsAssertionBodyHashOperator
6653
67-
:param target: Value used by the operator.
68-
:type target: bool, date, datetime, dict, float, int, list, str, UUID, none_type
54+
:param target: Value used by the operator in assertions. Can be either a number or string.
55+
:type target: SyntheticsAssertionTargetValue
6956
7057
:param type: Type of the assertion.
7158
:type type: SyntheticsAssertionBodyHashType

src/datadog_api_client/v1/model/synthetics_assertion_json_path_target_target.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,30 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Any, Union
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11-
date,
12-
datetime,
13-
none_type,
1411
unset,
1512
UnsetType,
16-
UUID,
1713
)
1814

1915

16+
if TYPE_CHECKING:
17+
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
18+
19+
2020
class SyntheticsAssertionJSONPathTargetTarget(ModelNormal):
2121
@cached_property
2222
def openapi_types(_):
23+
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
24+
2325
return {
2426
"elements_operator": (str,),
2527
"json_path": (str,),
2628
"operator": (str,),
27-
"target_value": (
28-
bool,
29-
date,
30-
datetime,
31-
dict,
32-
float,
33-
int,
34-
list,
35-
str,
36-
UUID,
37-
none_type,
38-
),
29+
"target_value": (SyntheticsAssertionTargetValue,),
3930
}
4031

4132
attribute_map = {
@@ -50,7 +41,7 @@ def __init__(
5041
elements_operator: Union[str, UnsetType] = unset,
5142
json_path: Union[str, UnsetType] = unset,
5243
operator: Union[str, UnsetType] = unset,
53-
target_value: Union[Any, UnsetType] = unset,
44+
target_value: Union[SyntheticsAssertionTargetValue, float, str, UnsetType] = unset,
5445
**kwargs,
5546
):
5647
"""
@@ -65,8 +56,8 @@ def __init__(
6556
:param operator: The specific operator to use on the path.
6657
:type operator: str, optional
6758
68-
:param target_value: The path target value to compare to.
69-
:type target_value: bool, date, datetime, dict, float, int, list, str, UUID, none_type, optional
59+
:param target_value: Value used by the operator in assertions. Can be either a number or string.
60+
:type target_value: SyntheticsAssertionTargetValue, optional
7061
"""
7162
if elements_operator is not unset:
7263
kwargs["elements_operator"] = elements_operator

src/datadog_api_client/v1/model/synthetics_assertion_target.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Any, Union, TYPE_CHECKING
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11-
date,
12-
datetime,
13-
none_type,
1411
unset,
1512
UnsetType,
16-
UUID,
1713
)
1814

1915

2016
if TYPE_CHECKING:
2117
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
18+
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
2219
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
2320
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
2421

@@ -27,24 +24,14 @@ class SyntheticsAssertionTarget(ModelNormal):
2724
@cached_property
2825
def openapi_types(_):
2926
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
27+
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
3028
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
3129
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
3230

3331
return {
3432
"operator": (SyntheticsAssertionOperator,),
3533
"_property": (str,),
36-
"target": (
37-
bool,
38-
date,
39-
datetime,
40-
dict,
41-
float,
42-
int,
43-
list,
44-
str,
45-
UUID,
46-
none_type,
47-
),
34+
"target": (SyntheticsAssertionTargetValue,),
4835
"timings_scope": (SyntheticsAssertionTimingsScope,),
4936
"type": (SyntheticsAssertionType,),
5037
}
@@ -60,7 +47,7 @@ def openapi_types(_):
6047
def __init__(
6148
self_,
6249
operator: SyntheticsAssertionOperator,
63-
target: Any,
50+
target: Union[SyntheticsAssertionTargetValue, float, str],
6451
type: SyntheticsAssertionType,
6552
_property: Union[str, UnsetType] = unset,
6653
timings_scope: Union[SyntheticsAssertionTimingsScope, UnsetType] = unset,
@@ -75,8 +62,8 @@ def __init__(
7562
:param _property: The associated assertion property.
7663
:type _property: str, optional
7764
78-
:param target: Value used by the operator.
79-
:type target: bool, date, datetime, dict, float, int, list, str, UUID, none_type
65+
:param target: Value used by the operator in assertions. Can be either a number or string.
66+
:type target: SyntheticsAssertionTargetValue
8067
8168
:param timings_scope: Timings scope for response time assertions.
8269
:type timings_scope: SyntheticsAssertionTimingsScope, optional
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelComposed,
9+
cached_property,
10+
)
11+
12+
13+
class SyntheticsAssertionTargetValue(ModelComposed):
14+
def __init__(self, **kwargs):
15+
"""
16+
Value used by the operator in assertions. Can be either a number or string.
17+
"""
18+
super().__init__(kwargs)
19+
20+
@cached_property
21+
def _composed_schemas(_):
22+
# we need this here to make our import statements work
23+
# we must store _composed_schemas in here so the code is only run
24+
# when we invoke this method. If we kept this at the class
25+
# level we would get an error because the class level
26+
# code would be run when this module is imported, and these composed
27+
# classes don't exist yet because their module has not finished
28+
# loading
29+
return {
30+
"oneOf": [
31+
float,
32+
str,
33+
],
34+
}

0 commit comments

Comments
 (0)