Skip to content

Add new synthetics HTTP javascript assertion #2091

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

Merged
merged 2 commits into from
Sep 4, 2024
Merged
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": "2024-09-04 15:23:38.044155",
"spec_repo_commit": "fe4f848e"
"regenerated": "2024-09-04 17:12:33.836340",
"spec_repo_commit": "8e0507d2"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-09-04 15:23:38.061137",
"spec_repo_commit": "fe4f848e"
"regenerated": "2024-09-04 17:12:33.853825",
"spec_repo_commit": "8e0507d2"
}
}
}
22 changes: 22 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13873,6 +13873,7 @@ components:
- $ref: '#/components/schemas/SyntheticsAssertionJSONPathTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJSONSchemaTarget'
- $ref: '#/components/schemas/SyntheticsAssertionXPathTarget'
- $ref: '#/components/schemas/SyntheticsAssertionJavascript'
SyntheticsAssertionBodyHashOperator:
description: Assertion operator to apply.
enum:
Expand Down Expand Up @@ -13989,6 +13990,27 @@ components:
metaSchema:
$ref: '#/components/schemas/SyntheticsAssertionJSONSchemaMetaSchema'
type: object
SyntheticsAssertionJavascript:
description: A JavaScript assertion.
properties:
code:
description: The JavaScript code that performs the assertions.
example: dd.expect(dd.response.statusCode).to.equal(200);
type: string
type:
$ref: '#/components/schemas/SyntheticsAssertionJavascriptType'
required:
- type
- code
type: object
SyntheticsAssertionJavascriptType:
description: Type of the assertion.
enum:
- javascript
example: javascript
type: string
x-enum-varnames:
- JAVASCRIPT
SyntheticsAssertionOperator:
description: Assertion operator to apply.
enum:
Expand Down
14 changes: 14 additions & 0 deletions docs/datadog_api_client.v1.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3910,6 +3910,20 @@ datadog\_api\_client.v1.model.synthetics\_assertion\_body\_hash\_type module
:members:
:show-inheritance:

datadog\_api\_client.v1.model.synthetics\_assertion\_javascript module
----------------------------------------------------------------------

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

datadog\_api\_client.v1.model.synthetics\_assertion\_javascript\_type module
----------------------------------------------------------------------------

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

datadog\_api\_client.v1.model.synthetics\_assertion\_json\_path\_operator module
--------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import SyntheticsAssertionBodyHashOperator
from datadog_api_client.v1.model.synthetics_assertion_body_hash_target import SyntheticsAssertionBodyHashTarget
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript
from datadog_api_client.v1.model.synthetics_assertion_javascript_type import SyntheticsAssertionJavascriptType
from datadog_api_client.v1.model.synthetics_assertion_json_path_operator import SyntheticsAssertionJSONPathOperator
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
Expand Down Expand Up @@ -103,6 +105,10 @@
target="a",
type=SyntheticsAssertionBodyHashType.BODY_HASH,
),
SyntheticsAssertionJavascript(
code="const hello = 'world';",
type=SyntheticsAssertionJavascriptType.JAVASCRIPT,
),
],
config_variables=[
SyntheticsConfigVariable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from datadog_api_client.v1.model.synthetics_assertion_body_hash_operator import SyntheticsAssertionBodyHashOperator
from datadog_api_client.v1.model.synthetics_assertion_body_hash_target import SyntheticsAssertionBodyHashTarget
from datadog_api_client.v1.model.synthetics_assertion_body_hash_type import SyntheticsAssertionBodyHashType
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript
from datadog_api_client.v1.model.synthetics_assertion_javascript_type import SyntheticsAssertionJavascriptType
from datadog_api_client.v1.model.synthetics_assertion_json_path_operator import SyntheticsAssertionJSONPathOperator
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_path_target_target import (
Expand Down Expand Up @@ -103,6 +105,10 @@
target="a",
type=SyntheticsAssertionBodyHashType.BODY_HASH,
),
SyntheticsAssertionJavascript(
code="const hello = 'world';",
type=SyntheticsAssertionJavascriptType.JAVASCRIPT,
),
],
config_variables=[
SyntheticsConfigVariable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript
from datadog_api_client.v1.model.synthetics_api_test_step import SyntheticsAPITestStep
from datadog_api_client.v1.model.synthetics_api_wait_step import SyntheticsAPIWaitStep

Expand Down Expand Up @@ -62,6 +63,7 @@ def __init__(
SyntheticsAssertionJSONPathTarget,
SyntheticsAssertionJSONSchemaTarget,
SyntheticsAssertionXPathTarget,
SyntheticsAssertionJavascript,
]
],
UnsetType,
Expand Down
5 changes: 5 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def __init__(self, **kwargs):

:param type: Type of the assertion.
:type type: SyntheticsAssertionType

:param code: The JavaScript code that performs the assertions.
:type code: str
"""
super().__init__(kwargs)

Expand All @@ -49,6 +52,7 @@ def _composed_schemas(_):
SyntheticsAssertionJSONSchemaTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript

return {
"oneOf": [
Expand All @@ -57,5 +61,6 @@ def _composed_schemas(_):
SyntheticsAssertionJSONPathTarget,
SyntheticsAssertionJSONSchemaTarget,
SyntheticsAssertionXPathTarget,
SyntheticsAssertionJavascript,
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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 typing import TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v1.model.synthetics_assertion_javascript_type import SyntheticsAssertionJavascriptType


class SyntheticsAssertionJavascript(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.synthetics_assertion_javascript_type import SyntheticsAssertionJavascriptType

return {
"code": (str,),
"type": (SyntheticsAssertionJavascriptType,),
}

attribute_map = {
"code": "code",
"type": "type",
}

def __init__(self_, code: str, type: SyntheticsAssertionJavascriptType, **kwargs):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Code Quality Violation

Suggested change
def __init__(self_, code: str, type: SyntheticsAssertionJavascriptType, **kwargs):
def __init__(self, code: str, type: SyntheticsAssertionJavascriptType, **kwargs):
first parameter of a class function should be self (...read more)

In a class method (that is not a class method nor a static method), the first argument must be self by convention.

Learn More

View in Datadog  Leave us feedback  Documentation

"""
A JavaScript assertion.

:param code: The JavaScript code that performs the assertions.
:type code: str

:param type: Type of the assertion.
:type type: SyntheticsAssertionJavascriptType
"""
super().__init__(kwargs)

self_.code = code
self_.type = type
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 (
ModelSimple,
cached_property,
)

from typing import ClassVar


class SyntheticsAssertionJavascriptType(ModelSimple):
"""
Type of the assertion.

:param value: If omitted defaults to "javascript". Must be one of ["javascript"].
:type value: str
"""

allowed_values = {
"javascript",
}
JAVASCRIPT: ClassVar["SyntheticsAssertionJavascriptType"]

@cached_property
def openapi_types(_):
return {
"value": (str,),
}


SyntheticsAssertionJavascriptType.JAVASCRIPT = SyntheticsAssertionJavascriptType("javascript")
2 changes: 2 additions & 0 deletions src/datadog_api_client/v1/model/synthetics_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from datadog_api_client.v1.model.synthetics_assertion_json_path_target import SyntheticsAssertionJSONPathTarget
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target import SyntheticsAssertionJSONSchemaTarget
from datadog_api_client.v1.model.synthetics_assertion_x_path_target import SyntheticsAssertionXPathTarget
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript


class SyntheticsTestConfig(ModelNormal):
Expand Down Expand Up @@ -58,6 +59,7 @@ def __init__(
SyntheticsAssertionJSONPathTarget,
SyntheticsAssertionJSONSchemaTarget,
SyntheticsAssertionXPathTarget,
SyntheticsAssertionJavascript,
]
],
UnsetType,
Expand Down
4 changes: 4 additions & 0 deletions src/datadog_api_client/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@
from datadog_api_client.v1.model.synthetics_assertion_json_schema_target_target import (
SyntheticsAssertionJSONSchemaTargetTarget,
)
from datadog_api_client.v1.model.synthetics_assertion_javascript import SyntheticsAssertionJavascript
from datadog_api_client.v1.model.synthetics_assertion_javascript_type import SyntheticsAssertionJavascriptType
from datadog_api_client.v1.model.synthetics_assertion_operator import SyntheticsAssertionOperator
from datadog_api_client.v1.model.synthetics_assertion_target import SyntheticsAssertionTarget
from datadog_api_client.v1.model.synthetics_assertion_timings_scope import SyntheticsAssertionTimingsScope
Expand Down Expand Up @@ -1557,6 +1559,8 @@
"SyntheticsAssertionJSONSchemaOperator",
"SyntheticsAssertionJSONSchemaTarget",
"SyntheticsAssertionJSONSchemaTargetTarget",
"SyntheticsAssertionJavascript",
"SyntheticsAssertionJavascriptType",
"SyntheticsAssertionOperator",
"SyntheticsAssertionTarget",
"SyntheticsAssertionTimingsScope",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-06-14T14:40:25.126Z
2024-08-05T15:40:27.317Z
Loading
Loading