Skip to content

Commit b379379

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Add meta and source fields to JSONAPIErrorItem (#2631)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent d4edf8f commit b379379

File tree

4 files changed

+283
-5
lines changed

4 files changed

+283
-5
lines changed

.apigentools-info

+4-4
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-01-06 18:09:30.835401",
8-
"spec_repo_commit": "c020103f"
7+
"regenerated": "2025-01-06 19:03:03.417793",
8+
"spec_repo_commit": "b56ea2d7"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-06 18:09:30.850332",
13-
"spec_repo_commit": "c020103f"
12+
"regenerated": "2025-01-06 19:03:03.432332",
13+
"spec_repo_commit": "b56ea2d7"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -15109,6 +15109,12 @@ components:
1510915109
the error.
1511015110
example: Missing required attribute in body
1511115111
type: string
15112+
meta:
15113+
additionalProperties: {}
15114+
description: Non-standard meta-information about the error
15115+
type: object
15116+
source:
15117+
$ref: '#/components/schemas/JSONAPIErrorItemSource'
1511215118
status:
1511315119
description: Status code of the response.
1511415120
example: '400'
@@ -15118,6 +15124,24 @@ components:
1511815124
example: Bad Request
1511915125
type: string
1512015126
type: object
15127+
JSONAPIErrorItemSource:
15128+
description: References to the source of the error.
15129+
properties:
15130+
header:
15131+
description: A string indicating the name of a single request header which
15132+
caused the error.
15133+
example: Authorization
15134+
type: string
15135+
parameter:
15136+
description: A string indicating which URI query parameter caused the error.
15137+
example: limit
15138+
type: string
15139+
pointer:
15140+
description: A JSON pointer to the value in the request document that caused
15141+
the error.
15142+
example: /data/attributes/title
15143+
type: string
15144+
type: object
1512115145
JSONAPIErrorResponse:
1512215146
description: API error response.
1512315147
properties:

src/main/java/com/datadog/api/client/v2/model/JSONAPIErrorItem.java

+64-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
/** API error response body */
2020
@JsonPropertyOrder({
2121
JSONAPIErrorItem.JSON_PROPERTY_DETAIL,
22+
JSONAPIErrorItem.JSON_PROPERTY_META,
23+
JSONAPIErrorItem.JSON_PROPERTY_SOURCE,
2224
JSONAPIErrorItem.JSON_PROPERTY_STATUS,
2325
JSONAPIErrorItem.JSON_PROPERTY_TITLE
2426
})
@@ -29,6 +31,12 @@ public class JSONAPIErrorItem {
2931
public static final String JSON_PROPERTY_DETAIL = "detail";
3032
private String detail;
3133

34+
public static final String JSON_PROPERTY_META = "meta";
35+
private Map<String, Object> meta = null;
36+
37+
public static final String JSON_PROPERTY_SOURCE = "source";
38+
private JSONAPIErrorItemSource source;
39+
3240
public static final String JSON_PROPERTY_STATUS = "status";
3341
private String status;
3442

@@ -56,6 +64,57 @@ public void setDetail(String detail) {
5664
this.detail = detail;
5765
}
5866

67+
public JSONAPIErrorItem meta(Map<String, Object> meta) {
68+
this.meta = meta;
69+
return this;
70+
}
71+
72+
public JSONAPIErrorItem putMetaItem(String key, Object metaItem) {
73+
if (this.meta == null) {
74+
this.meta = new HashMap<>();
75+
}
76+
this.meta.put(key, metaItem);
77+
return this;
78+
}
79+
80+
/**
81+
* Non-standard meta-information about the error
82+
*
83+
* @return meta
84+
*/
85+
@jakarta.annotation.Nullable
86+
@JsonProperty(JSON_PROPERTY_META)
87+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
88+
public Map<String, Object> getMeta() {
89+
return meta;
90+
}
91+
92+
public void setMeta(Map<String, Object> meta) {
93+
this.meta = meta;
94+
}
95+
96+
public JSONAPIErrorItem source(JSONAPIErrorItemSource source) {
97+
this.source = source;
98+
this.unparsed |= source.unparsed;
99+
return this;
100+
}
101+
102+
/**
103+
* References to the source of the error.
104+
*
105+
* @return source
106+
*/
107+
@jakarta.annotation.Nullable
108+
@JsonProperty(JSON_PROPERTY_SOURCE)
109+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
110+
public JSONAPIErrorItemSource getSource() {
111+
return source;
112+
}
113+
114+
public void setSource(JSONAPIErrorItemSource source) {
115+
this.source = source;
116+
}
117+
59118
public JSONAPIErrorItem status(String status) {
60119
this.status = status;
61120
return this;
@@ -155,21 +214,25 @@ public boolean equals(Object o) {
155214
}
156215
JSONAPIErrorItem jsonapiErrorItem = (JSONAPIErrorItem) o;
157216
return Objects.equals(this.detail, jsonapiErrorItem.detail)
217+
&& Objects.equals(this.meta, jsonapiErrorItem.meta)
218+
&& Objects.equals(this.source, jsonapiErrorItem.source)
158219
&& Objects.equals(this.status, jsonapiErrorItem.status)
159220
&& Objects.equals(this.title, jsonapiErrorItem.title)
160221
&& Objects.equals(this.additionalProperties, jsonapiErrorItem.additionalProperties);
161222
}
162223

163224
@Override
164225
public int hashCode() {
165-
return Objects.hash(detail, status, title, additionalProperties);
226+
return Objects.hash(detail, meta, source, status, title, additionalProperties);
166227
}
167228

168229
@Override
169230
public String toString() {
170231
StringBuilder sb = new StringBuilder();
171232
sb.append("class JSONAPIErrorItem {\n");
172233
sb.append(" detail: ").append(toIndentedString(detail)).append("\n");
234+
sb.append(" meta: ").append(toIndentedString(meta)).append("\n");
235+
sb.append(" source: ").append(toIndentedString(source)).append("\n");
173236
sb.append(" status: ").append(toIndentedString(status)).append("\n");
174237
sb.append(" title: ").append(toIndentedString(title)).append("\n");
175238
sb.append(" additionalProperties: ")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v2.model;
8+
9+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
10+
import com.fasterxml.jackson.annotation.JsonAnySetter;
11+
import com.fasterxml.jackson.annotation.JsonIgnore;
12+
import com.fasterxml.jackson.annotation.JsonInclude;
13+
import com.fasterxml.jackson.annotation.JsonProperty;
14+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
15+
import java.util.HashMap;
16+
import java.util.Map;
17+
import java.util.Objects;
18+
19+
/** References to the source of the error. */
20+
@JsonPropertyOrder({
21+
JSONAPIErrorItemSource.JSON_PROPERTY_HEADER,
22+
JSONAPIErrorItemSource.JSON_PROPERTY_PARAMETER,
23+
JSONAPIErrorItemSource.JSON_PROPERTY_POINTER
24+
})
25+
@jakarta.annotation.Generated(
26+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
27+
public class JSONAPIErrorItemSource {
28+
@JsonIgnore public boolean unparsed = false;
29+
public static final String JSON_PROPERTY_HEADER = "header";
30+
private String header;
31+
32+
public static final String JSON_PROPERTY_PARAMETER = "parameter";
33+
private String parameter;
34+
35+
public static final String JSON_PROPERTY_POINTER = "pointer";
36+
private String pointer;
37+
38+
public JSONAPIErrorItemSource header(String header) {
39+
this.header = header;
40+
return this;
41+
}
42+
43+
/**
44+
* A string indicating the name of a single request header which caused the error.
45+
*
46+
* @return header
47+
*/
48+
@jakarta.annotation.Nullable
49+
@JsonProperty(JSON_PROPERTY_HEADER)
50+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
51+
public String getHeader() {
52+
return header;
53+
}
54+
55+
public void setHeader(String header) {
56+
this.header = header;
57+
}
58+
59+
public JSONAPIErrorItemSource parameter(String parameter) {
60+
this.parameter = parameter;
61+
return this;
62+
}
63+
64+
/**
65+
* A string indicating which URI query parameter caused the error.
66+
*
67+
* @return parameter
68+
*/
69+
@jakarta.annotation.Nullable
70+
@JsonProperty(JSON_PROPERTY_PARAMETER)
71+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
72+
public String getParameter() {
73+
return parameter;
74+
}
75+
76+
public void setParameter(String parameter) {
77+
this.parameter = parameter;
78+
}
79+
80+
public JSONAPIErrorItemSource pointer(String pointer) {
81+
this.pointer = pointer;
82+
return this;
83+
}
84+
85+
/**
86+
* A JSON pointer to the value in the request document that caused the error.
87+
*
88+
* @return pointer
89+
*/
90+
@jakarta.annotation.Nullable
91+
@JsonProperty(JSON_PROPERTY_POINTER)
92+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
93+
public String getPointer() {
94+
return pointer;
95+
}
96+
97+
public void setPointer(String pointer) {
98+
this.pointer = pointer;
99+
}
100+
101+
/**
102+
* A container for additional, undeclared properties. This is a holder for any undeclared
103+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
104+
*/
105+
private Map<String, Object> additionalProperties;
106+
107+
/**
108+
* Set the additional (undeclared) property with the specified name and value. If the property
109+
* does not already exist, create it otherwise replace it.
110+
*
111+
* @param key The arbitrary key to set
112+
* @param value The associated value
113+
* @return JSONAPIErrorItemSource
114+
*/
115+
@JsonAnySetter
116+
public JSONAPIErrorItemSource putAdditionalProperty(String key, Object value) {
117+
if (this.additionalProperties == null) {
118+
this.additionalProperties = new HashMap<String, Object>();
119+
}
120+
this.additionalProperties.put(key, value);
121+
return this;
122+
}
123+
124+
/**
125+
* Return the additional (undeclared) property.
126+
*
127+
* @return The additional properties
128+
*/
129+
@JsonAnyGetter
130+
public Map<String, Object> getAdditionalProperties() {
131+
return additionalProperties;
132+
}
133+
134+
/**
135+
* Return the additional (undeclared) property with the specified name.
136+
*
137+
* @param key The arbitrary key to get
138+
* @return The specific additional property for the given key
139+
*/
140+
public Object getAdditionalProperty(String key) {
141+
if (this.additionalProperties == null) {
142+
return null;
143+
}
144+
return this.additionalProperties.get(key);
145+
}
146+
147+
/** Return true if this JSONAPIErrorItemSource object is equal to o. */
148+
@Override
149+
public boolean equals(Object o) {
150+
if (this == o) {
151+
return true;
152+
}
153+
if (o == null || getClass() != o.getClass()) {
154+
return false;
155+
}
156+
JSONAPIErrorItemSource jsonapiErrorItemSource = (JSONAPIErrorItemSource) o;
157+
return Objects.equals(this.header, jsonapiErrorItemSource.header)
158+
&& Objects.equals(this.parameter, jsonapiErrorItemSource.parameter)
159+
&& Objects.equals(this.pointer, jsonapiErrorItemSource.pointer)
160+
&& Objects.equals(this.additionalProperties, jsonapiErrorItemSource.additionalProperties);
161+
}
162+
163+
@Override
164+
public int hashCode() {
165+
return Objects.hash(header, parameter, pointer, additionalProperties);
166+
}
167+
168+
@Override
169+
public String toString() {
170+
StringBuilder sb = new StringBuilder();
171+
sb.append("class JSONAPIErrorItemSource {\n");
172+
sb.append(" header: ").append(toIndentedString(header)).append("\n");
173+
sb.append(" parameter: ").append(toIndentedString(parameter)).append("\n");
174+
sb.append(" pointer: ").append(toIndentedString(pointer)).append("\n");
175+
sb.append(" additionalProperties: ")
176+
.append(toIndentedString(additionalProperties))
177+
.append("\n");
178+
sb.append('}');
179+
return sb.toString();
180+
}
181+
182+
/**
183+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
184+
*/
185+
private String toIndentedString(Object o) {
186+
if (o == null) {
187+
return "null";
188+
}
189+
return o.toString().replace("\n", "\n ");
190+
}
191+
}

0 commit comments

Comments
 (0)