Skip to content

Commit 550d37b

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Remove user fields that are unsupported by the Incidents API (#2721)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent a2e98fc commit 550d37b

File tree

5 files changed

+495
-22
lines changed

5 files changed

+495
-22
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-10-02 20:43:00.348465",
8-
"spec_repo_commit": "76b7b19d"
7+
"regenerated": "2024-10-03 13:53:52.224483",
8+
"spec_repo_commit": "2c46d95c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-02 20:43:00.363246",
13-
"spec_repo_commit": "76b7b19d"
12+
"regenerated": "2024-10-03 13:53:52.241054",
13+
"spec_repo_commit": "2c46d95c"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10930,7 +10930,7 @@ components:
1093010930
IncidentResponseIncludedItem:
1093110931
description: An object related to an incident that is included in the response.
1093210932
oneOf:
10933-
- $ref: '#/components/schemas/User'
10933+
- $ref: '#/components/schemas/IncidentUserData'
1093410934
- $ref: '#/components/schemas/IncidentAttachmentData'
1093510935
IncidentResponseMeta:
1093610936
description: The metadata object containing pagination metadata.
@@ -11869,6 +11869,37 @@ components:
1186911869
required:
1187011870
- data
1187111871
type: object
11872+
IncidentUserAttributes:
11873+
description: Attributes of user object returned by the API.
11874+
properties:
11875+
email:
11876+
description: Email of the user.
11877+
type: string
11878+
handle:
11879+
description: Handle of the user.
11880+
type: string
11881+
icon:
11882+
description: URL of the user's icon.
11883+
type: string
11884+
name:
11885+
description: Name of the user.
11886+
nullable: true
11887+
type: string
11888+
uuid:
11889+
description: UUID of the user.
11890+
type: string
11891+
type: object
11892+
IncidentUserData:
11893+
description: User object returned by the API.
11894+
properties:
11895+
attributes:
11896+
$ref: '#/components/schemas/IncidentUserAttributes'
11897+
id:
11898+
description: ID of the user.
11899+
type: string
11900+
type:
11901+
$ref: '#/components/schemas/UsersType'
11902+
type: object
1187211903
IncidentUserDefinedFieldType:
1187311904
description: The incident user defined fields type.
1187411905
enum:

api/datadogV2/model_incident_response_included_item.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import (
1010

1111
// IncidentResponseIncludedItem - An object related to an incident that is included in the response.
1212
type IncidentResponseIncludedItem struct {
13-
User *User
13+
IncidentUserData *IncidentUserData
1414
IncidentAttachmentData *IncidentAttachmentData
1515

1616
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
1717
UnparsedObject interface{}
1818
}
1919

20-
// UserAsIncidentResponseIncludedItem is a convenience function that returns User wrapped in IncidentResponseIncludedItem.
21-
func UserAsIncidentResponseIncludedItem(v *User) IncidentResponseIncludedItem {
22-
return IncidentResponseIncludedItem{User: v}
20+
// IncidentUserDataAsIncidentResponseIncludedItem is a convenience function that returns IncidentUserData wrapped in IncidentResponseIncludedItem.
21+
func IncidentUserDataAsIncidentResponseIncludedItem(v *IncidentUserData) IncidentResponseIncludedItem {
22+
return IncidentResponseIncludedItem{IncidentUserData: v}
2323
}
2424

2525
// IncidentAttachmentDataAsIncidentResponseIncludedItem is a convenience function that returns IncidentAttachmentData wrapped in IncidentResponseIncludedItem.
@@ -31,21 +31,21 @@ func IncidentAttachmentDataAsIncidentResponseIncludedItem(v *IncidentAttachmentD
3131
func (obj *IncidentResponseIncludedItem) UnmarshalJSON(data []byte) error {
3232
var err error
3333
match := 0
34-
// try to unmarshal data into User
35-
err = datadog.Unmarshal(data, &obj.User)
34+
// try to unmarshal data into IncidentUserData
35+
err = datadog.Unmarshal(data, &obj.IncidentUserData)
3636
if err == nil {
37-
if obj.User != nil && obj.User.UnparsedObject == nil {
38-
jsonUser, _ := datadog.Marshal(obj.User)
39-
if string(jsonUser) == "{}" && string(data) != "{}" { // empty struct
40-
obj.User = nil
37+
if obj.IncidentUserData != nil && obj.IncidentUserData.UnparsedObject == nil {
38+
jsonIncidentUserData, _ := datadog.Marshal(obj.IncidentUserData)
39+
if string(jsonIncidentUserData) == "{}" && string(data) != "{}" { // empty struct
40+
obj.IncidentUserData = nil
4141
} else {
4242
match++
4343
}
4444
} else {
45-
obj.User = nil
45+
obj.IncidentUserData = nil
4646
}
4747
} else {
48-
obj.User = nil
48+
obj.IncidentUserData = nil
4949
}
5050

5151
// try to unmarshal data into IncidentAttachmentData
@@ -67,7 +67,7 @@ func (obj *IncidentResponseIncludedItem) UnmarshalJSON(data []byte) error {
6767

6868
if match != 1 { // more than 1 match
6969
// reset to nil
70-
obj.User = nil
70+
obj.IncidentUserData = nil
7171
obj.IncidentAttachmentData = nil
7272
return datadog.Unmarshal(data, &obj.UnparsedObject)
7373
}
@@ -76,8 +76,8 @@ func (obj *IncidentResponseIncludedItem) UnmarshalJSON(data []byte) error {
7676

7777
// MarshalJSON turns data from the first non-nil pointers in the struct to JSON.
7878
func (obj IncidentResponseIncludedItem) MarshalJSON() ([]byte, error) {
79-
if obj.User != nil {
80-
return datadog.Marshal(&obj.User)
79+
if obj.IncidentUserData != nil {
80+
return datadog.Marshal(&obj.IncidentUserData)
8181
}
8282

8383
if obj.IncidentAttachmentData != nil {
@@ -92,8 +92,8 @@ func (obj IncidentResponseIncludedItem) MarshalJSON() ([]byte, error) {
9292

9393
// GetActualInstance returns the actual instance.
9494
func (obj *IncidentResponseIncludedItem) GetActualInstance() interface{} {
95-
if obj.User != nil {
96-
return obj.User
95+
if obj.IncidentUserData != nil {
96+
return obj.IncidentUserData
9797
}
9898

9999
if obj.IncidentAttachmentData != nil {

0 commit comments

Comments
 (0)