Skip to content

Commit b3e8a33

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Make id required in patch status pages request schemas, id and attributes required in post/patch status pages request schemas (#3648)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 80b3c7f commit b3e8a33

13 files changed

Lines changed: 187 additions & 202 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13283,6 +13283,7 @@ components:
1328313283
type:
1328413284
$ref: '#/components/schemas/StatusPagesComponentGroupType'
1328513285
required:
13286+
- attributes
1328613287
- type
1328713288
type: object
1328813289
CreateComponentRequestDataAttributes:
@@ -13367,7 +13368,7 @@ components:
1336713368
properties:
1336813369
id:
1336913370
description: The ID of the group.
13370-
example: ''
13371+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
1337113372
format: uuid
1337213373
type: string
1337313374
type:
@@ -13569,6 +13570,7 @@ components:
1356913570
type:
1357013571
$ref: '#/components/schemas/PatchDegradationRequestDataType'
1357113572
required:
13573+
- attributes
1357213574
- type
1357313575
type: object
1357413576
CreateDegradationRequestDataAttributes:
@@ -13604,7 +13606,7 @@ components:
1360413606
properties:
1360513607
id:
1360613608
description: The ID of the component. Must be a component of type `component`.
13607-
example: ''
13609+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
1360813610
format: uuid
1360913611
type: string
1361013612
name:
@@ -14327,6 +14329,7 @@ components:
1432714329
type:
1432814330
$ref: '#/components/schemas/StatusPageDataType'
1432914331
required:
14332+
- attributes
1433014333
- type
1433114334
type: object
1433214335
CreateStatusPageRequestDataAttributes:
@@ -18391,7 +18394,7 @@ components:
1839118394
properties:
1839218395
id:
1839318396
description: The ID of the component.
18394-
example: ''
18397+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
1839518398
format: uuid
1839618399
type: string
1839718400
name:
@@ -18436,7 +18439,7 @@ components:
1843618439
properties:
1843718440
id:
1843818441
description: Identifier of the component affected at the time of the update.
18439-
example: ''
18442+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
1844018443
format: uuid
1844118444
type: string
1844218445
name:
@@ -18512,7 +18515,7 @@ components:
1851218515
properties:
1851318516
id:
1851418517
description: The ID of the status page.
18515-
example: ''
18518+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
1851618519
format: uuid
1851718520
type: string
1851818521
type:
@@ -43661,11 +43664,14 @@ components:
4366143664
$ref: '#/components/schemas/PatchComponentRequestDataAttributes'
4366243665
id:
4366343666
description: The ID of the component.
43667+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
4366443668
format: uuid
4366543669
type: string
4366643670
type:
4366743671
$ref: '#/components/schemas/StatusPagesComponentGroupType'
4366843672
required:
43673+
- attributes
43674+
- id
4366943675
- type
4367043676
type: object
4367143677
PatchComponentRequestDataAttributes:
@@ -43704,11 +43710,14 @@ components:
4370443710
$ref: '#/components/schemas/PatchDegradationRequestDataAttributes'
4370543711
id:
4370643712
description: The ID of the degradation.
43713+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
4370743714
format: uuid
4370843715
type: string
4370943716
type:
4371043717
$ref: '#/components/schemas/PatchDegradationRequestDataType'
4371143718
required:
43719+
- attributes
43720+
- id
4371243721
- type
4371343722
type: object
4371443723
PatchDegradationRequestDataAttributes:
@@ -43739,7 +43748,7 @@ components:
4373943748
properties:
4374043749
id:
4374143750
description: The ID of the component. Must be a component of type `component`.
43742-
example: ''
43751+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
4374343752
format: uuid
4374443753
type: string
4374543754
name:
@@ -43844,11 +43853,14 @@ components:
4384443853
$ref: '#/components/schemas/PatchStatusPageRequestDataAttributes'
4384543854
id:
4384643855
description: The ID of the status page.
43856+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
4384743857
format: uuid
4384843858
type: string
4384943859
type:
4385043860
$ref: '#/components/schemas/StatusPageDataType'
4385143861
required:
43862+
- attributes
43863+
- id
4385243864
- type
4385343865
type: object
4385443866
PatchStatusPageRequestDataAttributes:
@@ -58776,7 +58788,7 @@ components:
5877658788
properties:
5877758789
id:
5877858790
description: The ID of the group the component belongs to.
58779-
example: ''
58791+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
5878058792
format: uuid
5878158793
type: string
5878258794
type:
@@ -58815,7 +58827,7 @@ components:
5881558827
properties:
5881658828
id:
5881758829
description: The ID of the status page the component belongs to.
58818-
example: ''
58830+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
5881958831
format: uuid
5882058832
type: string
5882158833
type:
@@ -58957,7 +58969,7 @@ components:
5895758969
nullable: true
5895858970
properties:
5895958971
id:
58960-
example: ''
58972+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
5896158973
format: uuid
5896258974
type: string
5896358975
type:
@@ -58999,7 +59011,7 @@ components:
5899959011
properties:
5900059012
id:
5900159013
description: The ID of the status page.
59002-
example: ''
59014+
example: 1234abcd-12ab-34cd-56ef-123456abcdef
5900359015
format: uuid
5900459016
type: string
5900559017
type:

api/datadogV2/model_create_component_request_data.go

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// CreateComponentRequestData
1414
type CreateComponentRequestData struct {
1515
// The supported attributes for creating a component.
16-
Attributes *CreateComponentRequestDataAttributes `json:"attributes,omitempty"`
16+
Attributes CreateComponentRequestDataAttributes `json:"attributes"`
1717
// The supported relationships for creating a component.
1818
Relationships *CreateComponentRequestDataRelationships `json:"relationships,omitempty"`
1919
// Components resource type.
@@ -27,8 +27,9 @@ type CreateComponentRequestData struct {
2727
// This constructor will assign default values to properties that have it defined,
2828
// and makes sure properties required by API are set, but the set of arguments
2929
// will change when the set of required properties is changed.
30-
func NewCreateComponentRequestData(typeVar StatusPagesComponentGroupType) *CreateComponentRequestData {
30+
func NewCreateComponentRequestData(attributes CreateComponentRequestDataAttributes, typeVar StatusPagesComponentGroupType) *CreateComponentRequestData {
3131
this := CreateComponentRequestData{}
32+
this.Attributes = attributes
3233
this.Type = typeVar
3334
return &this
3435
}
@@ -43,32 +44,27 @@ func NewCreateComponentRequestDataWithDefaults() *CreateComponentRequestData {
4344
return &this
4445
}
4546

46-
// GetAttributes returns the Attributes field value if set, zero value otherwise.
47+
// GetAttributes returns the Attributes field value.
4748
func (o *CreateComponentRequestData) GetAttributes() CreateComponentRequestDataAttributes {
48-
if o == nil || o.Attributes == nil {
49+
if o == nil {
4950
var ret CreateComponentRequestDataAttributes
5051
return ret
5152
}
52-
return *o.Attributes
53+
return o.Attributes
5354
}
5455

55-
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
56+
// GetAttributesOk returns a tuple with the Attributes field value
5657
// and a boolean to check if the value has been set.
5758
func (o *CreateComponentRequestData) GetAttributesOk() (*CreateComponentRequestDataAttributes, bool) {
58-
if o == nil || o.Attributes == nil {
59+
if o == nil {
5960
return nil, false
6061
}
61-
return o.Attributes, true
62-
}
63-
64-
// HasAttributes returns a boolean if a field has been set.
65-
func (o *CreateComponentRequestData) HasAttributes() bool {
66-
return o != nil && o.Attributes != nil
62+
return &o.Attributes, true
6763
}
6864

69-
// SetAttributes gets a reference to the given CreateComponentRequestDataAttributes and assigns it to the Attributes field.
65+
// SetAttributes sets field value.
7066
func (o *CreateComponentRequestData) SetAttributes(v CreateComponentRequestDataAttributes) {
71-
o.Attributes = &v
67+
o.Attributes = v
7268
}
7369

7470
// GetRelationships returns the Relationships field value if set, zero value otherwise.
@@ -128,9 +124,7 @@ func (o CreateComponentRequestData) MarshalJSON() ([]byte, error) {
128124
if o.UnparsedObject != nil {
129125
return datadog.Marshal(o.UnparsedObject)
130126
}
131-
if o.Attributes != nil {
132-
toSerialize["attributes"] = o.Attributes
133-
}
127+
toSerialize["attributes"] = o.Attributes
134128
if o.Relationships != nil {
135129
toSerialize["relationships"] = o.Relationships
136130
}
@@ -145,13 +139,16 @@ func (o CreateComponentRequestData) MarshalJSON() ([]byte, error) {
145139
// UnmarshalJSON deserializes the given payload.
146140
func (o *CreateComponentRequestData) UnmarshalJSON(bytes []byte) (err error) {
147141
all := struct {
148-
Attributes *CreateComponentRequestDataAttributes `json:"attributes,omitempty"`
142+
Attributes *CreateComponentRequestDataAttributes `json:"attributes"`
149143
Relationships *CreateComponentRequestDataRelationships `json:"relationships,omitempty"`
150144
Type *StatusPagesComponentGroupType `json:"type"`
151145
}{}
152146
if err = datadog.Unmarshal(bytes, &all); err != nil {
153147
return datadog.Unmarshal(bytes, &o.UnparsedObject)
154148
}
149+
if all.Attributes == nil {
150+
return fmt.Errorf("required field attributes missing")
151+
}
155152
if all.Type == nil {
156153
return fmt.Errorf("required field type missing")
157154
}
@@ -163,10 +160,10 @@ func (o *CreateComponentRequestData) UnmarshalJSON(bytes []byte) (err error) {
163160
}
164161

165162
hasInvalidField := false
166-
if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
163+
if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
167164
hasInvalidField = true
168165
}
169-
o.Attributes = all.Attributes
166+
o.Attributes = *all.Attributes
170167
if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil {
171168
hasInvalidField = true
172169
}

api/datadogV2/model_create_degradation_request_data.go

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// CreateDegradationRequestData
1414
type CreateDegradationRequestData struct {
1515
// The supported attributes for creating a degradation.
16-
Attributes *CreateDegradationRequestDataAttributes `json:"attributes,omitempty"`
16+
Attributes CreateDegradationRequestDataAttributes `json:"attributes"`
1717
// Degradations resource type.
1818
Type PatchDegradationRequestDataType `json:"type"`
1919
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -25,8 +25,9 @@ type CreateDegradationRequestData struct {
2525
// This constructor will assign default values to properties that have it defined,
2626
// and makes sure properties required by API are set, but the set of arguments
2727
// will change when the set of required properties is changed.
28-
func NewCreateDegradationRequestData(typeVar PatchDegradationRequestDataType) *CreateDegradationRequestData {
28+
func NewCreateDegradationRequestData(attributes CreateDegradationRequestDataAttributes, typeVar PatchDegradationRequestDataType) *CreateDegradationRequestData {
2929
this := CreateDegradationRequestData{}
30+
this.Attributes = attributes
3031
this.Type = typeVar
3132
return &this
3233
}
@@ -41,32 +42,27 @@ func NewCreateDegradationRequestDataWithDefaults() *CreateDegradationRequestData
4142
return &this
4243
}
4344

44-
// GetAttributes returns the Attributes field value if set, zero value otherwise.
45+
// GetAttributes returns the Attributes field value.
4546
func (o *CreateDegradationRequestData) GetAttributes() CreateDegradationRequestDataAttributes {
46-
if o == nil || o.Attributes == nil {
47+
if o == nil {
4748
var ret CreateDegradationRequestDataAttributes
4849
return ret
4950
}
50-
return *o.Attributes
51+
return o.Attributes
5152
}
5253

53-
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
54+
// GetAttributesOk returns a tuple with the Attributes field value
5455
// and a boolean to check if the value has been set.
5556
func (o *CreateDegradationRequestData) GetAttributesOk() (*CreateDegradationRequestDataAttributes, bool) {
56-
if o == nil || o.Attributes == nil {
57+
if o == nil {
5758
return nil, false
5859
}
59-
return o.Attributes, true
60-
}
61-
62-
// HasAttributes returns a boolean if a field has been set.
63-
func (o *CreateDegradationRequestData) HasAttributes() bool {
64-
return o != nil && o.Attributes != nil
60+
return &o.Attributes, true
6561
}
6662

67-
// SetAttributes gets a reference to the given CreateDegradationRequestDataAttributes and assigns it to the Attributes field.
63+
// SetAttributes sets field value.
6864
func (o *CreateDegradationRequestData) SetAttributes(v CreateDegradationRequestDataAttributes) {
69-
o.Attributes = &v
65+
o.Attributes = v
7066
}
7167

7268
// GetType returns the Type field value.
@@ -98,9 +94,7 @@ func (o CreateDegradationRequestData) MarshalJSON() ([]byte, error) {
9894
if o.UnparsedObject != nil {
9995
return datadog.Marshal(o.UnparsedObject)
10096
}
101-
if o.Attributes != nil {
102-
toSerialize["attributes"] = o.Attributes
103-
}
97+
toSerialize["attributes"] = o.Attributes
10498
toSerialize["type"] = o.Type
10599

106100
for key, value := range o.AdditionalProperties {
@@ -112,12 +106,15 @@ func (o CreateDegradationRequestData) MarshalJSON() ([]byte, error) {
112106
// UnmarshalJSON deserializes the given payload.
113107
func (o *CreateDegradationRequestData) UnmarshalJSON(bytes []byte) (err error) {
114108
all := struct {
115-
Attributes *CreateDegradationRequestDataAttributes `json:"attributes,omitempty"`
109+
Attributes *CreateDegradationRequestDataAttributes `json:"attributes"`
116110
Type *PatchDegradationRequestDataType `json:"type"`
117111
}{}
118112
if err = datadog.Unmarshal(bytes, &all); err != nil {
119113
return datadog.Unmarshal(bytes, &o.UnparsedObject)
120114
}
115+
if all.Attributes == nil {
116+
return fmt.Errorf("required field attributes missing")
117+
}
121118
if all.Type == nil {
122119
return fmt.Errorf("required field type missing")
123120
}
@@ -129,10 +126,10 @@ func (o *CreateDegradationRequestData) UnmarshalJSON(bytes []byte) (err error) {
129126
}
130127

131128
hasInvalidField := false
132-
if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
129+
if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
133130
hasInvalidField = true
134131
}
135-
o.Attributes = all.Attributes
132+
o.Attributes = *all.Attributes
136133
if !all.Type.IsValid() {
137134
hasInvalidField = true
138135
} else {

0 commit comments

Comments
 (0)