Skip to content

Commit 910ab16

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Additional rules to inject openapi type (#2420)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent cc911f6 commit 910ab16

File tree

7 files changed

+42
-32
lines changed

7 files changed

+42
-32
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-02-18 20:22:46.542723",
8-
"spec_repo_commit": "c8707cdc"
7+
"regenerated": "2025-02-18 22:25:34.103145",
8+
"spec_repo_commit": "98988fd6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-02-18 20:22:46.599032",
13-
"spec_repo_commit": "c8707cdc"
12+
"regenerated": "2025-02-18 22:25:34.118419",
13+
"spec_repo_commit": "98988fd6"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,7 @@ components:
15301530
type: array
15311531
required:
15321532
- exclude_only
1533+
type: object
15331534
AWSNamespaceFiltersIncludeOnly:
15341535
description: Include only these namespaces.
15351536
properties:
@@ -1543,6 +1544,7 @@ components:
15431544
type: array
15441545
required:
15451546
- include_only
1547+
type: object
15461548
AWSNamespaceTagFilter:
15471549
description: 'AWS Metrics Collection tag filters list. Defaults to `[]`.
15481550

@@ -1676,6 +1678,7 @@ components:
16761678
type: boolean
16771679
required:
16781680
- include_all
1681+
type: object
16791682
AWSRegionsIncludeOnly:
16801683
description: Include only these regions.
16811684
properties:
@@ -1689,6 +1692,7 @@ components:
16891692
type: array
16901693
required:
16911694
- include_only
1695+
type: object
16921696
AWSResourcesConfig:
16931697
description: AWS Resources Collection config.
16941698
properties:
@@ -10934,13 +10938,15 @@ components:
1093410938
definition:
1093510939
description: The API definition.
1093610940
type: object
10941+
type: object
1093710942
EntityV3APISpecInterfaceFileRef:
1093810943
additionalProperties: false
1093910944
description: The definition of `EntityV3APISpecInterfaceFileRef` object.
1094010945
properties:
1094110946
fileRef:
1094210947
description: The reference to the API definition file.
1094310948
type: string
10949+
type: object
1094410950
EntityV3APIVersion:
1094510951
description: The schema version of entity type. The field is known as schema-version
1094610952
in the previous version.
@@ -11206,6 +11212,7 @@ components:
1120611212
type: string
1120711213
required:
1120811214
- name
11215+
type: object
1120911216
EntityV3MetadataContactsItems:
1121011217
additionalProperties: false
1121111218
description: The definition of Entity V3 Metadata Contacts Items object.
@@ -20228,6 +20235,7 @@ components:
2022820235
$ref: '#/components/schemas/OktaAccountUpdateRequestAttributes'
2022920236
type:
2023020237
$ref: '#/components/schemas/OktaAccountType'
20238+
type: object
2023120239
OktaAccountsResponse:
2023220240
description: The expected response schema when getting Okta accounts.
2023320241
properties:
@@ -25939,6 +25947,7 @@ components:
2593925947
description: The version of the rule.
2594025948
format: int64
2594125949
type: integer
25950+
type: object
2594225951
SecurityMonitoringSignalRuleResponseQuery:
2594325952
description: Query for matching rule on signals.
2594425953
properties:
@@ -26475,6 +26484,7 @@ components:
2647526484
description: The version of the rule.
2647626485
format: int64
2647726486
type: integer
26487+
type: object
2647826488
SecurityMonitoringStandardRuleTestPayload:
2647926489
description: The payload of a rule to test
2648026490
properties:
@@ -32266,6 +32276,7 @@ components:
3226632276
type: boolean
3226732277
required:
3226832278
- include_all
32279+
type: object
3226932280
XRayServicesIncludeOnly:
3227032281
description: Include only these services. Defaults to `[]`.
3227132282
nullable: true
@@ -32280,6 +32291,7 @@ components:
3228032291
type: array
3228132292
required:
3228232293
- include_only
32294+
type: object
3228332295
XRayServicesList:
3228432296
description: AWS X-Ray services to collect traces from. Defaults to `include_only`.
3228532297
oneOf:

examples/v2/software-catalog/UpsertCatalogEntity.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from datadog_api_client.v2.model.entity_v3_datadog_pipelines import EntityV3DatadogPipelines
1515
from datadog_api_client.v2.model.entity_v3_integrations import EntityV3Integrations
1616
from datadog_api_client.v2.model.entity_v3_metadata import EntityV3Metadata
17+
from datadog_api_client.v2.model.entity_v3_metadata_additional_owners_items import EntityV3MetadataAdditionalOwnersItems
1718
from datadog_api_client.v2.model.entity_v3_metadata_contacts_items import EntityV3MetadataContactsItems
1819
from datadog_api_client.v2.model.entity_v3_metadata_links_items import EntityV3MetadataLinksItems
1920
from datadog_api_client.v2.model.entity_v3_service import EntityV3Service
@@ -52,7 +53,11 @@
5253
),
5354
kind=EntityV3ServiceKind.SERVICE,
5455
metadata=EntityV3Metadata(
55-
additional_owners=[],
56+
additional_owners=[
57+
EntityV3MetadataAdditionalOwnersItems(
58+
name="",
59+
),
60+
],
5661
contacts=[
5762
EntityV3MetadataContactsItems(
5863
contact="https://slack/",

src/datadog_api_client/v2/model/entity_v3_metadata.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919

2020
if TYPE_CHECKING:
21+
from datadog_api_client.v2.model.entity_v3_metadata_additional_owners_items import (
22+
EntityV3MetadataAdditionalOwnersItems,
23+
)
2124
from datadog_api_client.v2.model.entity_v3_metadata_contacts_items import EntityV3MetadataContactsItems
2225
from datadog_api_client.v2.model.entity_v3_metadata_links_items import EntityV3MetadataLinksItems
2326

@@ -41,11 +44,14 @@ def additional_properties_type(_):
4144

4245
@cached_property
4346
def openapi_types(_):
47+
from datadog_api_client.v2.model.entity_v3_metadata_additional_owners_items import (
48+
EntityV3MetadataAdditionalOwnersItems,
49+
)
4450
from datadog_api_client.v2.model.entity_v3_metadata_contacts_items import EntityV3MetadataContactsItems
4551
from datadog_api_client.v2.model.entity_v3_metadata_links_items import EntityV3MetadataLinksItems
4652

4753
return {
48-
"additional_owners": ([bool, date, datetime, dict, float, int, list, str, UUID, none_type],),
54+
"additional_owners": ([EntityV3MetadataAdditionalOwnersItems],),
4955
"contacts": ([EntityV3MetadataContactsItems],),
5056
"description": (str,),
5157
"display_name": (str,),
@@ -92,7 +98,7 @@ def openapi_types(_):
9298
def __init__(
9399
self_,
94100
name: str,
95-
additional_owners: Union[List[Any], UnsetType] = unset,
101+
additional_owners: Union[List[EntityV3MetadataAdditionalOwnersItems], UnsetType] = unset,
96102
contacts: Union[List[EntityV3MetadataContactsItems], UnsetType] = unset,
97103
description: Union[str, UnsetType] = unset,
98104
display_name: Union[str, UnsetType] = unset,
@@ -109,7 +115,7 @@ def __init__(
109115
The definition of Entity V3 Metadata object.
110116
111117
:param additional_owners: The additional owners of the entity, usually a team.
112-
:type additional_owners: [bool, date, datetime, dict, float, int, list, str, UUID, none_type], optional
118+
:type additional_owners: [EntityV3MetadataAdditionalOwnersItems], optional
113119
114120
:param contacts: A list of contacts for the entity.
115121
:type contacts: [EntityV3MetadataContactsItems], optional

src/datadog_api_client/v2/model/okta_account_update_request.py

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

6-
from typing import Any, TYPE_CHECKING
6+
from typing import 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:
19-
pass
15+
from datadog_api_client.v2.model.okta_account_update_request_data import OktaAccountUpdateRequestData
2016

2117

2218
class OktaAccountUpdateRequest(ModelNormal):
2319
@cached_property
2420
def openapi_types(_):
21+
from datadog_api_client.v2.model.okta_account_update_request_data import OktaAccountUpdateRequestData
22+
2523
return {
26-
"data": (
27-
bool,
28-
date,
29-
datetime,
30-
dict,
31-
float,
32-
int,
33-
list,
34-
str,
35-
UUID,
36-
none_type,
37-
),
24+
"data": (OktaAccountUpdateRequestData,),
3825
}
3926

4027
attribute_map = {
4128
"data": "data",
4229
}
4330

44-
def __init__(self_, data: Any, **kwargs):
31+
def __init__(self_, data: OktaAccountUpdateRequestData, **kwargs):
4532
"""
4633
Payload schema when updating an Okta account.
4734
4835
:param data: Data object for updating an Okta account.
49-
:type data: bool, date, datetime, dict, float, int, list, str, UUID, none_type
36+
:type data: OktaAccountUpdateRequestData
5037
"""
5138
super().__init__(kwargs)
5239

tests/v2/features/okta_integration.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ Feature: Okta Integration
9797
Scenario: Update Okta account returns "Bad Request" response
9898
Given new "UpdateOktaAccount" request
9999
And request contains "account_id" parameter from "REPLACE.ME"
100-
And body with value {}
100+
And body with value {"data": {"attributes": {"auth_method": "oauth", "domain": "https://dev-test.okta.com/"}, "type": "okta-accounts"}}
101101
When the request is sent
102102
Then the response status is 400 Bad Request
103103

104104
@generated @skip @team:DataDog/saas-integrations
105105
Scenario: Update Okta account returns "Not Found" response
106106
Given new "UpdateOktaAccount" request
107107
And request contains "account_id" parameter from "REPLACE.ME"
108-
And body with value {}
108+
And body with value {"data": {"attributes": {"auth_method": "oauth", "domain": "https://dev-test.okta.com/"}, "type": "okta-accounts"}}
109109
When the request is sent
110110
Then the response status is 404 Not Found
111111

tests/v2/features/software_catalog.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ Feature: Software Catalog
1010
@generated @skip @team:DataDog/service-catalog
1111
Scenario: Create or update entities returns "ACCEPTED" response
1212
Given new "UpsertCatalogEntity" request
13-
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
13+
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
1414
When the request is sent
1515
Then the response status is 202 ACCEPTED
1616

1717
@generated @skip @team:DataDog/service-catalog
1818
Scenario: Create or update entities returns "Bad Request" response
1919
Given new "UpsertCatalogEntity" request
20-
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
20+
And body with value {"apiVersion": "v3", "datadog": {"codeLocations": [{"paths": []}], "events": [{}], "logs": [{}], "performanceData": {"tags": []}, "pipelines": {"fingerprints": []}}, "integrations": {"opsgenie": {"serviceURL": "https://www.opsgenie.com/service/shopping-cart"}, "pagerduty": {"serviceURL": "https://www.pagerduty.com/service-directory/Pshopping-cart"}}, "kind": "service", "metadata": {"additionalOwners": [{"name": ""}], "contacts": [{"contact": "https://slack/", "type": "slack"}], "id": "4b163705-23c0-4573-b2fb-f6cea2163fcb", "inheritFrom": "application:default/myapp", "links": [{"name": "mylink", "type": "link", "url": "https://mylink"}], "name": "myService", "namespace": "default", "tags": ["this:tag", "that:tag"]}, "spec": {"dependsOn": [], "languages": []}}
2121
When the request is sent
2222
Then the response status is 400 Bad Request
2323

0 commit comments

Comments
 (0)