Skip to content

Commit dc9b08e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add JSONSchema assertion support to API and multistep tests (#1925)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent dea346e commit dc9b08e

File tree

30 files changed

+451
-82
lines changed

30 files changed

+451
-82
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": "2024-04-19 20:49:45.386499",
8-
"spec_repo_commit": "c3db9ec1"
7+
"regenerated": "2024-04-22 11:29:47.866511",
8+
"spec_repo_commit": "0f37d2e6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-04-19 20:49:45.403012",
13-
"spec_repo_commit": "c3db9ec1"
12+
"regenerated": "2024-04-22 11:29:47.883528",
13+
"spec_repo_commit": "0f37d2e6"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13627,6 +13627,7 @@ components:
1362713627
oneOf:
1362813628
- $ref: '#/components/schemas/SyntheticsAssertionTarget'
1362913629
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
13630+
- $ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTarget'
1363013631
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
1363113632
SyntheticsAssertionJSONPathOperator:
1363213633
description: Assertion operator to apply.
@@ -13664,6 +13665,45 @@ components:
1366413665
targetValue:
1366513666
description: The path target value to compare to.
1366613667
type: object
13668+
SyntheticsAssertionJSONSchemaMetaSchema:
13669+
description: The JSON Schema meta-schema version used in the assertion.
13670+
enum:
13671+
- draft-07
13672+
- draft-06
13673+
type: string
13674+
x-enum-varnames:
13675+
- DRAFT_07
13676+
- DRAFT_06
13677+
SyntheticsAssertionJSONSchemaOperator:
13678+
description: Assertion operator to apply.
13679+
enum:
13680+
- validatesJSONSchema
13681+
example: validatesJSONSchema
13682+
type: string
13683+
x-enum-varnames:
13684+
- VALIDATES_JSON_SCHEMA
13685+
SyntheticsAssertionJSONSchemaTarget:
13686+
description: An assertion for the `validatesJSONSchema` operator.
13687+
properties:
13688+
operator:
13689+
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaOperator'
13690+
target:
13691+
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTargetTarget'
13692+
type:
13693+
$ref: '#/components/schemas/SyntheticsAssertionType'
13694+
required:
13695+
- type
13696+
- operator
13697+
type: object
13698+
SyntheticsAssertionJSONSchemaTargetTarget:
13699+
description: Composed target for `validatesJSONSchema` operator.
13700+
properties:
13701+
jsonSchema:
13702+
description: The JSON Schema to assert.
13703+
type: string
13704+
metaSchema:
13705+
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaMetaSchema'
13706+
type: object
1366713707
SyntheticsAssertionOperator:
1366813708
description: Assertion operator to apply.
1366913709
enum:

docs/datadog_api_client.v1.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,6 +3865,34 @@ synthetics\_assertion\_json\_path\_target\_target
38653865
:members:
38663866
:show-inheritance:
38673867

3868+
synthetics\_assertion\_json\_schema\_meta\_schema
3869+
-------------------------------------------------
3870+
3871+
.. automodule:: datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema
3872+
:members:
3873+
:show-inheritance:
3874+
3875+
synthetics\_assertion\_json\_schema\_operator
3876+
---------------------------------------------
3877+
3878+
.. automodule:: datadog_api_client.v1.model.synthetics_assertion_json_schema_operator
3879+
:members:
3880+
:show-inheritance:
3881+
3882+
synthetics\_assertion\_json\_schema\_target
3883+
-------------------------------------------
3884+
3885+
.. automodule:: datadog_api_client.v1.model.synthetics_assertion_json_schema_target
3886+
:members:
3887+
:show-inheritance:
3888+
3889+
synthetics\_assertion\_json\_schema\_target\_target
3890+
---------------------------------------------------
3891+
3892+
.. automodule:: datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target
3893+
:members:
3894+
:show-inheritance:
3895+
38683896
synthetics\_assertion\_operator
38693897
-------------------------------
38703898

examples/v1/synthetics/CreateSyntheticsAPITest_1487281163.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
1313
SyntheticsAssertionJSONPathTargetTarget,
1414
)
15+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema import (
16+
SyntheticsAssertionJSONSchemaMetaSchema,
17+
)
18+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_operator import SyntheticsAssertionJSONSchemaOperator
19+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
20+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
21+
SyntheticsAssertionJSONSchemaTargetTarget,
22+
)
1523
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
1624
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
1725
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
@@ -60,6 +68,14 @@
6068
),
6169
type=SyntheticsAssertionType.BODY,
6270
),
71+
SyntheticsAssertionJSONSchemaTarget(
72+
operator=SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA,
73+
target=SyntheticsAssertionJSONSchemaTargetTarget(
74+
meta_schema=SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07,
75+
json_schema='{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
76+
),
77+
type=SyntheticsAssertionType.BODY,
78+
),
6379
SyntheticsAssertionXPathTarget(
6480
operator=SyntheticsAssertionXPathOperator.VALIDATES_X_PATH,
6581
target=SyntheticsAssertionXPathTargetTarget(

examples/v1/synthetics/CreateSyntheticsAPITest_960766374.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
1313
SyntheticsAssertionJSONPathTargetTarget,
1414
)
15+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema import (
16+
SyntheticsAssertionJSONSchemaMetaSchema,
17+
)
18+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_operator import SyntheticsAssertionJSONSchemaOperator
19+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
20+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
21+
SyntheticsAssertionJSONSchemaTargetTarget,
22+
)
1523
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
1624
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
1725
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
@@ -57,6 +65,14 @@
5765
),
5866
type=SyntheticsAssertionType.BODY,
5967
),
68+
SyntheticsAssertionJSONSchemaTarget(
69+
operator=SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA,
70+
target=SyntheticsAssertionJSONSchemaTargetTarget(
71+
meta_schema=SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07,
72+
json_schema='{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
73+
),
74+
type=SyntheticsAssertionType.BODY,
75+
),
6076
SyntheticsAssertionXPathTarget(
6177
operator=SyntheticsAssertionXPathOperator.VALIDATES_X_PATH,
6278
target=SyntheticsAssertionXPathTargetTarget(

examples/v1/synthetics/UpdateAPITest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
1414
SyntheticsAssertionJSONPathTargetTarget,
1515
)
16+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_meta_schema import (
17+
SyntheticsAssertionJSONSchemaMetaSchema,
18+
)
19+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_operator import SyntheticsAssertionJSONSchemaOperator
20+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
21+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
22+
SyntheticsAssertionJSONSchemaTargetTarget,
23+
)
1624
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
1725
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
1826
from datadog_api_client.v1.model.synthetics_assertion_type import SyntheticsAssertionType
@@ -53,6 +61,14 @@
5361
),
5462
type=SyntheticsAssertionType.BODY,
5563
),
64+
SyntheticsAssertionJSONSchemaTarget(
65+
operator=SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA,
66+
target=SyntheticsAssertionJSONSchemaTargetTarget(
67+
meta_schema=SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07,
68+
json_schema='{"type": "object", "properties":{"slideshow":{"type":"object"}}}',
69+
),
70+
type=SyntheticsAssertionType.BODY,
71+
),
5672
],
5773
config_variables=[
5874
SyntheticsConfigVariable(

src/datadog_api_client/v1/model/synthetics_api_test_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from datadog_api_client.v1.model.synthetics_api_step import SyntheticsAPIStep
2121
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
2222
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
23+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
2324
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
2425

2526

@@ -55,6 +56,7 @@ def __init__(
5556
SyntheticsAssertion,
5657
SyntheticsAssertionTarget,
5758
SyntheticsAssertionJSONPathTarget,
59+
SyntheticsAssertionJSONSchemaTarget,
5860
SyntheticsAssertionXPathTarget,
5961
]
6062
],

src/datadog_api_client/v1/model/synthetics_assertion.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ def _composed_schemas(_):
4444
# loading
4545
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
4646
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
47+
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import (
48+
SyntheticsAssertionJSONSchemaTarget,
49+
)
4750
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
4851

4952
return {
5053
"oneOf": [
5154
SyntheticsAssertionTarget,
5255
SyntheticsAssertionJSONPathTarget,
56+
SyntheticsAssertionJSONSchemaTarget,
5357
SyntheticsAssertionXPathTarget,
5458
],
5559
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class SyntheticsAssertionJSONSchemaMetaSchema(ModelSimple):
16+
"""
17+
The JSON Schema meta-schema version used in the assertion.
18+
19+
:param value: Must be one of ["draft-07", "draft-06"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"draft-07",
25+
"draft-06",
26+
}
27+
DRAFT_07: ClassVar["SyntheticsAssertionJSONSchemaMetaSchema"]
28+
DRAFT_06: ClassVar["SyntheticsAssertionJSONSchemaMetaSchema"]
29+
30+
@cached_property
31+
def openapi_types(_):
32+
return {
33+
"value": (str,),
34+
}
35+
36+
37+
SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_07 = SyntheticsAssertionJSONSchemaMetaSchema("draft-07")
38+
SyntheticsAssertionJSONSchemaMetaSchema.DRAFT_06 = SyntheticsAssertionJSONSchemaMetaSchema("draft-06")
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class SyntheticsAssertionJSONSchemaOperator(ModelSimple):
16+
"""
17+
Assertion operator to apply.
18+
19+
:param value: If omitted defaults to "validatesJSONSchema". Must be one of ["validatesJSONSchema"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"validatesJSONSchema",
25+
}
26+
VALIDATES_JSON_SCHEMA: ClassVar["SyntheticsAssertionJSONSchemaOperator"]
27+
28+
@cached_property
29+
def openapi_types(_):
30+
return {
31+
"value": (str,),
32+
}
33+
34+
35+
SyntheticsAssertionJSONSchemaOperator.VALIDATES_JSON_SCHEMA = SyntheticsAssertionJSONSchemaOperator(
36+
"validatesJSONSchema"
37+
)

0 commit comments

Comments
 (0)