Skip to content

Make assertion target be int or string #2545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-02 04:31:14.572410",
"spec_repo_commit": "272cce39"
"regenerated": "2025-05-02 14:21:30.035661",
"spec_repo_commit": "022c8d0f"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-05-02 04:31:14.659660",
"spec_repo_commit": "272cce39"
"regenerated": "2025-05-02 14:21:30.053505",
"spec_repo_commit": "022c8d0f"
}
}
}
19 changes: 17 additions & 2 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14222,8 +14222,8 @@ components:
operator:
$ref: '#/components/schemas/SyntheticsAssertionBodyHashOperator'
target:
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
description: Value used by the operator.
example: 123456
type:
$ref: '#/components/schemas/SyntheticsAssertionBodyHashType'
required:
Expand Down Expand Up @@ -14279,6 +14279,7 @@ components:
description: The specific operator to use on the path.
type: string
targetValue:
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
description: The path target value to compare to.
type: object
SyntheticsAssertionJSONSchemaMetaSchema:
Expand Down Expand Up @@ -14386,8 +14387,8 @@ components:
description: The associated assertion property.
type: string
target:
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
description: Value used by the operator.
example: 123456
timingsScope:
$ref: '#/components/schemas/SyntheticsAssertionTimingsScope'
type:
Expand All @@ -14397,6 +14398,19 @@ components:
- operator
- target
type: object
SyntheticsAssertionTargetValue:
description: Value used by the operator in assertions. Can be either a number
or string.
oneOf:
- $ref: '#/components/schemas/SyntheticsAssertionTargetValueNumber'
- $ref: '#/components/schemas/SyntheticsAssertionTargetValueString'
SyntheticsAssertionTargetValueNumber:
description: Numeric value used by the operator in assertions.
format: int64
type: integer
SyntheticsAssertionTargetValueString:
description: String value used by the operator in assertions.
type: string
SyntheticsAssertionTimingsScope:
description: Timings scope for response time assertions.
enum:
Expand Down Expand Up @@ -14481,6 +14495,7 @@ components:
description: The specific operator to use on the path.
type: string
targetValue:
$ref: '#/components/schemas/SyntheticsAssertionTargetValue'
description: The path target value to compare to.
xPath:
description: The X path to assert.
Expand Down
7 changes: 7 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4078,6 +4078,13 @@ datadog\_api\_client.v1.model.synthetics\_assertion\_target module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.synthetics\_assertion\_target\_value module
-------------------------------------------------------------------------

.. automodule:: datadog_api_client.v1.model.synthetics_assertion_target_value
:members:
:show-inheritance:

datadog\_api\_client.v1.model.synthetics\_assertion\_timings\_scope module
--------------------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions src/datadog_api_client/v1/model/synthetics_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __init__(self, **kwargs):
:param _property: The associated assertion property.
:type _property: str, optional

:param target: Value used by the operator.
:type target: bool, date, datetime, dict, float, int, list, str, UUID, none_type
:param target: Value used by the operator in assertions. Can be either a number or string.
:type target: SyntheticsAssertionTargetValue

:param timings_scope: Timings scope for response time assertions.
:type timings_scope: SyntheticsAssertionTimingsScope, optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, TYPE_CHECKING
from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
date,
datetime,
none_type,
UUID,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import SyntheticsAssertionBodyHashOperator
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType


Expand All @@ -26,22 +23,12 @@ def openapi_types(_):
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import (
SyntheticsAssertionBodyHashOperator,
)
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType

return {
"operator": (SyntheticsAssertionBodyHashOperator,),
"target": (
bool,
date,
datetime,
dict,
float,
int,
list,
str,
UUID,
none_type,
),
"target": (SyntheticsAssertionTargetValue,),
"type": (SyntheticsAssertionBodyHashType,),
}

Expand All @@ -54,7 +41,7 @@ def openapi_types(_):
def __init__(
self_,
operator: SyntheticsAssertionBodyHashOperator,
target: Any,
target: Union[SyntheticsAssertionTargetValue, int, str],
type: SyntheticsAssertionBodyHashType,
**kwargs,
):
Expand All @@ -64,8 +51,8 @@ def __init__(
:param operator: Assertion operator to apply.
:type operator: SyntheticsAssertionBodyHashOperator

:param target: Value used by the operator.
:type target: bool, date, datetime, dict, float, int, list, str, UUID, none_type
:param target: Value used by the operator in assertions. Can be either a number or string.
:type target: SyntheticsAssertionTargetValue

:param type: Type of the assertion.
:type type: SyntheticsAssertionBodyHashType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,30 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, Union
from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
date,
datetime,
none_type,
unset,
UnsetType,
UUID,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue


class SyntheticsAssertionJSONPathTargetTarget(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue

return {
"elements_operator": (str,),
"json_path": (str,),
"operator": (str,),
"target_value": (
bool,
date,
datetime,
dict,
float,
int,
list,
str,
UUID,
none_type,
),
"target_value": (SyntheticsAssertionTargetValue,),
}

attribute_map = {
Expand All @@ -50,7 +41,7 @@ def __init__(
elements_operator: Union[str, UnsetType] = unset,
json_path: Union[str, UnsetType] = unset,
operator: Union[str, UnsetType] = unset,
target_value: Union[Any, UnsetType] = unset,
target_value: Union[SyntheticsAssertionTargetValue, int, str, UnsetType] = unset,
**kwargs,
):
"""
Expand All @@ -65,8 +56,8 @@ def __init__(
:param operator: The specific operator to use on the path.
:type operator: str, optional

:param target_value: The path target value to compare to.
:type target_value: bool, date, datetime, dict, float, int, list, str, UUID, none_type, optional
:param target_value: Value used by the operator in assertions. Can be either a number or string.
:type target_value: SyntheticsAssertionTargetValue, optional
"""
if elements_operator is not unset:
kwargs["elements_operator"] = elements_operator
Expand Down
27 changes: 7 additions & 20 deletions src/datadog_api_client/v1/model/synthetics_assertion_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import Any, Union, TYPE_CHECKING
from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
date,
datetime,
none_type,
unset,
UnsetType,
UUID,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType

Expand All @@ -27,24 +24,14 @@ class SyntheticsAssertionTarget(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target_value import SyntheticsAssertionTargetValue
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType

return {
"operator": (SyntheticsAssertionOperator,),
"_property": (str,),
"target": (
bool,
date,
datetime,
dict,
float,
int,
list,
str,
UUID,
none_type,
),
"target": (SyntheticsAssertionTargetValue,),
"timings_scope": (SyntheticsAssertionTimingsScope,),
"type": (SyntheticsAssertionType,),
}
Expand All @@ -60,7 +47,7 @@ def openapi_types(_):
def __init__(
self_,
operator: SyntheticsAssertionOperator,
target: Any,
target: Union[SyntheticsAssertionTargetValue, int, str],
type: SyntheticsAssertionType,
_property: Union[str, UnsetType] = unset,
timings_scope: Union[SyntheticsAssertionTimingsScope, UnsetType] = unset,
Expand All @@ -75,8 +62,8 @@ def __init__(
:param _property: The associated assertion property.
:type _property: str, optional

:param target: Value used by the operator.
:type target: bool, date, datetime, dict, float, int, list, str, UUID, none_type
:param target: Value used by the operator in assertions. Can be either a number or string.
:type target: SyntheticsAssertionTargetValue

:param timings_scope: Timings scope for response time assertions.
:type timings_scope: SyntheticsAssertionTimingsScope, optional
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelComposed,
cached_property,
)


class SyntheticsAssertionTargetValue(ModelComposed):
def __init__(self, **kwargs):
"""
Value used by the operator in assertions. Can be either a number or string.
"""
super().__init__(kwargs)

@cached_property
def _composed_schemas(_):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
return {
"oneOf": [
int,
str,
],
}
Loading
Loading