Skip to content

Commit 38e9300

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Remove user fields that are unsupported by the Incidents API (#2512)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 9596cd5 commit 38e9300

File tree

5 files changed

+520
-33
lines changed

5 files changed

+520
-33
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:42:58.523618",
8-
"spec_repo_commit": "76b7b19d"
7+
"regenerated": "2024-10-03 13:53:46.307323",
8+
"spec_repo_commit": "2c46d95c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-02 20:42:58.538507",
13-
"spec_repo_commit": "76b7b19d"
12+
"regenerated": "2024-10-03 13:53:46.321725",
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:

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

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,45 +81,48 @@ public IncidentResponseIncludedItem deserialize(JsonParser jp, DeserializationCo
8181
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
8282
int match = 0;
8383
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
84-
// deserialize User
84+
// deserialize IncidentUserData
8585
try {
8686
boolean attemptParsing = true;
8787
// ensure that we respect type coercion as set on the client ObjectMapper
88-
if (User.class.equals(Integer.class)
89-
|| User.class.equals(Long.class)
90-
|| User.class.equals(Float.class)
91-
|| User.class.equals(Double.class)
92-
|| User.class.equals(Boolean.class)
93-
|| User.class.equals(String.class)) {
88+
if (IncidentUserData.class.equals(Integer.class)
89+
|| IncidentUserData.class.equals(Long.class)
90+
|| IncidentUserData.class.equals(Float.class)
91+
|| IncidentUserData.class.equals(Double.class)
92+
|| IncidentUserData.class.equals(Boolean.class)
93+
|| IncidentUserData.class.equals(String.class)) {
9494
attemptParsing = typeCoercion;
9595
if (!attemptParsing) {
9696
attemptParsing |=
97-
((User.class.equals(Integer.class) || User.class.equals(Long.class))
97+
((IncidentUserData.class.equals(Integer.class)
98+
|| IncidentUserData.class.equals(Long.class))
9899
&& token == JsonToken.VALUE_NUMBER_INT);
99100
attemptParsing |=
100-
((User.class.equals(Float.class) || User.class.equals(Double.class))
101+
((IncidentUserData.class.equals(Float.class)
102+
|| IncidentUserData.class.equals(Double.class))
101103
&& (token == JsonToken.VALUE_NUMBER_FLOAT
102104
|| token == JsonToken.VALUE_NUMBER_INT));
103105
attemptParsing |=
104-
(User.class.equals(Boolean.class)
106+
(IncidentUserData.class.equals(Boolean.class)
105107
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
106-
attemptParsing |= (User.class.equals(String.class) && token == JsonToken.VALUE_STRING);
108+
attemptParsing |=
109+
(IncidentUserData.class.equals(String.class) && token == JsonToken.VALUE_STRING);
107110
}
108111
}
109112
if (attemptParsing) {
110-
tmp = tree.traverse(jp.getCodec()).readValueAs(User.class);
113+
tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentUserData.class);
111114
// TODO: there is no validation against JSON schema constraints
112115
// (min, max, enum, pattern...), this does not perform a strict JSON
113116
// validation, which means the 'match' count may be higher than it should be.
114-
if (!((User) tmp).unparsed) {
117+
if (!((IncidentUserData) tmp).unparsed) {
115118
deserialized = tmp;
116119
match++;
117120
}
118-
log.log(Level.FINER, "Input data matches schema 'User'");
121+
log.log(Level.FINER, "Input data matches schema 'IncidentUserData'");
119122
}
120123
} catch (Exception e) {
121124
// deserialization failed, continue
122-
log.log(Level.FINER, "Input data does not match schema 'User'", e);
125+
log.log(Level.FINER, "Input data does not match schema 'IncidentUserData'", e);
123126
}
124127

125128
// deserialize IncidentAttachmentData
@@ -197,7 +200,7 @@ public IncidentResponseIncludedItem() {
197200
super("oneOf", Boolean.FALSE);
198201
}
199202

200-
public IncidentResponseIncludedItem(User o) {
203+
public IncidentResponseIncludedItem(IncidentUserData o) {
201204
super("oneOf", Boolean.FALSE);
202205
setActualInstance(o);
203206
}
@@ -208,7 +211,7 @@ public IncidentResponseIncludedItem(IncidentAttachmentData o) {
208211
}
209212

210213
static {
211-
schemas.put("User", new GenericType<User>() {});
214+
schemas.put("IncidentUserData", new GenericType<IncidentUserData>() {});
212215
schemas.put("IncidentAttachmentData", new GenericType<IncidentAttachmentData>() {});
213216
JSON.registerDescendants(
214217
IncidentResponseIncludedItem.class, Collections.unmodifiableMap(schemas));
@@ -221,14 +224,14 @@ public Map<String, GenericType> getSchemas() {
221224

222225
/**
223226
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
224-
* against the oneOf child schemas: User, IncidentAttachmentData
227+
* against the oneOf child schemas: IncidentUserData, IncidentAttachmentData
225228
*
226229
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
227230
* composed schema (allOf, anyOf, oneOf).
228231
*/
229232
@Override
230233
public void setActualInstance(Object instance) {
231-
if (JSON.isInstanceOf(User.class, instance, new HashSet<Class<?>>())) {
234+
if (JSON.isInstanceOf(IncidentUserData.class, instance, new HashSet<Class<?>>())) {
232235
super.setActualInstance(instance);
233236
return;
234237
}
@@ -241,28 +244,29 @@ public void setActualInstance(Object instance) {
241244
super.setActualInstance(instance);
242245
return;
243246
}
244-
throw new RuntimeException("Invalid instance type. Must be User, IncidentAttachmentData");
247+
throw new RuntimeException(
248+
"Invalid instance type. Must be IncidentUserData, IncidentAttachmentData");
245249
}
246250

247251
/**
248-
* Get the actual instance, which can be the following: User, IncidentAttachmentData
252+
* Get the actual instance, which can be the following: IncidentUserData, IncidentAttachmentData
249253
*
250-
* @return The actual instance (User, IncidentAttachmentData)
254+
* @return The actual instance (IncidentUserData, IncidentAttachmentData)
251255
*/
252256
@Override
253257
public Object getActualInstance() {
254258
return super.getActualInstance();
255259
}
256260

257261
/**
258-
* Get the actual instance of `User`. If the actual instance is not `User`, the ClassCastException
259-
* will be thrown.
262+
* Get the actual instance of `IncidentUserData`. If the actual instance is not
263+
* `IncidentUserData`, the ClassCastException will be thrown.
260264
*
261-
* @return The actual instance of `User`
262-
* @throws ClassCastException if the instance is not `User`
265+
* @return The actual instance of `IncidentUserData`
266+
* @throws ClassCastException if the instance is not `IncidentUserData`
263267
*/
264-
public User getUser() throws ClassCastException {
265-
return (User) super.getActualInstance();
268+
public IncidentUserData getIncidentUserData() throws ClassCastException {
269+
return (IncidentUserData) super.getActualInstance();
266270
}
267271

268272
/**

0 commit comments

Comments
 (0)