Skip to content

Commit 6421881

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ac4e81b of spec repo
1 parent 658a548 commit 6421881

File tree

2 files changed

+70
-70
lines changed

2 files changed

+70
-70
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25656,9 +25656,9 @@ components:
2565625656
WidgetTime:
2565725657
description: Time setting for the widget.
2565825658
oneOf:
25659-
- $ref: '#/components/schemas/WidgetLegacyLiveSpan'
2566025659
- $ref: '#/components/schemas/WidgetNewLiveSpan'
2566125660
- $ref: '#/components/schemas/WidgetNewFixedSpan'
25661+
- $ref: '#/components/schemas/WidgetLegacyLiveSpan'
2566225662
WidgetTimeWindows:
2566325663
description: Define a time window.
2566425664
enum:

src/main/java/com/datadog/api/client/v1/model/WidgetTime.java

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -77,51 +77,6 @@ public WidgetTime deserialize(JsonParser jp, DeserializationContext ctxt)
7777
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
7878
int match = 0;
7979
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
80-
// deserialize WidgetLegacyLiveSpan
81-
try {
82-
boolean attemptParsing = true;
83-
// ensure that we respect type coercion as set on the client ObjectMapper
84-
if (WidgetLegacyLiveSpan.class.equals(Integer.class)
85-
|| WidgetLegacyLiveSpan.class.equals(Long.class)
86-
|| WidgetLegacyLiveSpan.class.equals(Float.class)
87-
|| WidgetLegacyLiveSpan.class.equals(Double.class)
88-
|| WidgetLegacyLiveSpan.class.equals(Boolean.class)
89-
|| WidgetLegacyLiveSpan.class.equals(String.class)) {
90-
attemptParsing = typeCoercion;
91-
if (!attemptParsing) {
92-
attemptParsing |=
93-
((WidgetLegacyLiveSpan.class.equals(Integer.class)
94-
|| WidgetLegacyLiveSpan.class.equals(Long.class))
95-
&& token == JsonToken.VALUE_NUMBER_INT);
96-
attemptParsing |=
97-
((WidgetLegacyLiveSpan.class.equals(Float.class)
98-
|| WidgetLegacyLiveSpan.class.equals(Double.class))
99-
&& (token == JsonToken.VALUE_NUMBER_FLOAT
100-
|| token == JsonToken.VALUE_NUMBER_INT));
101-
attemptParsing |=
102-
(WidgetLegacyLiveSpan.class.equals(Boolean.class)
103-
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
104-
attemptParsing |=
105-
(WidgetLegacyLiveSpan.class.equals(String.class)
106-
&& token == JsonToken.VALUE_STRING);
107-
}
108-
}
109-
if (attemptParsing) {
110-
tmp = tree.traverse(jp.getCodec()).readValueAs(WidgetLegacyLiveSpan.class);
111-
// TODO: there is no validation against JSON schema constraints
112-
// (min, max, enum, pattern...), this does not perform a strict JSON
113-
// validation, which means the 'match' count may be higher than it should be.
114-
if (!((WidgetLegacyLiveSpan) tmp).unparsed) {
115-
deserialized = tmp;
116-
match++;
117-
}
118-
log.log(Level.FINER, "Input data matches schema 'WidgetLegacyLiveSpan'");
119-
}
120-
} catch (Exception e) {
121-
// deserialization failed, continue
122-
log.log(Level.FINER, "Input data does not match schema 'WidgetLegacyLiveSpan'", e);
123-
}
124-
12580
// deserialize WidgetNewLiveSpan
12681
try {
12782
boolean attemptParsing = true;
@@ -210,6 +165,51 @@ public WidgetTime deserialize(JsonParser jp, DeserializationContext ctxt)
210165
log.log(Level.FINER, "Input data does not match schema 'WidgetNewFixedSpan'", e);
211166
}
212167

168+
// deserialize WidgetLegacyLiveSpan
169+
try {
170+
boolean attemptParsing = true;
171+
// ensure that we respect type coercion as set on the client ObjectMapper
172+
if (WidgetLegacyLiveSpan.class.equals(Integer.class)
173+
|| WidgetLegacyLiveSpan.class.equals(Long.class)
174+
|| WidgetLegacyLiveSpan.class.equals(Float.class)
175+
|| WidgetLegacyLiveSpan.class.equals(Double.class)
176+
|| WidgetLegacyLiveSpan.class.equals(Boolean.class)
177+
|| WidgetLegacyLiveSpan.class.equals(String.class)) {
178+
attemptParsing = typeCoercion;
179+
if (!attemptParsing) {
180+
attemptParsing |=
181+
((WidgetLegacyLiveSpan.class.equals(Integer.class)
182+
|| WidgetLegacyLiveSpan.class.equals(Long.class))
183+
&& token == JsonToken.VALUE_NUMBER_INT);
184+
attemptParsing |=
185+
((WidgetLegacyLiveSpan.class.equals(Float.class)
186+
|| WidgetLegacyLiveSpan.class.equals(Double.class))
187+
&& (token == JsonToken.VALUE_NUMBER_FLOAT
188+
|| token == JsonToken.VALUE_NUMBER_INT));
189+
attemptParsing |=
190+
(WidgetLegacyLiveSpan.class.equals(Boolean.class)
191+
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
192+
attemptParsing |=
193+
(WidgetLegacyLiveSpan.class.equals(String.class)
194+
&& token == JsonToken.VALUE_STRING);
195+
}
196+
}
197+
if (attemptParsing) {
198+
tmp = tree.traverse(jp.getCodec()).readValueAs(WidgetLegacyLiveSpan.class);
199+
// TODO: there is no validation against JSON schema constraints
200+
// (min, max, enum, pattern...), this does not perform a strict JSON
201+
// validation, which means the 'match' count may be higher than it should be.
202+
if (!((WidgetLegacyLiveSpan) tmp).unparsed) {
203+
deserialized = tmp;
204+
match++;
205+
}
206+
log.log(Level.FINER, "Input data matches schema 'WidgetLegacyLiveSpan'");
207+
}
208+
} catch (Exception e) {
209+
// deserialization failed, continue
210+
log.log(Level.FINER, "Input data does not match schema 'WidgetLegacyLiveSpan'", e);
211+
}
212+
213213
WidgetTime ret = new WidgetTime();
214214
if (match == 1) {
215215
ret.setActualInstance(deserialized);
@@ -238,25 +238,25 @@ public WidgetTime() {
238238
super("oneOf", Boolean.FALSE);
239239
}
240240

241-
public WidgetTime(WidgetLegacyLiveSpan o) {
241+
public WidgetTime(WidgetNewLiveSpan o) {
242242
super("oneOf", Boolean.FALSE);
243243
setActualInstance(o);
244244
}
245245

246-
public WidgetTime(WidgetNewLiveSpan o) {
246+
public WidgetTime(WidgetNewFixedSpan o) {
247247
super("oneOf", Boolean.FALSE);
248248
setActualInstance(o);
249249
}
250250

251-
public WidgetTime(WidgetNewFixedSpan o) {
251+
public WidgetTime(WidgetLegacyLiveSpan o) {
252252
super("oneOf", Boolean.FALSE);
253253
setActualInstance(o);
254254
}
255255

256256
static {
257-
schemas.put("WidgetLegacyLiveSpan", new GenericType<WidgetLegacyLiveSpan>() {});
258257
schemas.put("WidgetNewLiveSpan", new GenericType<WidgetNewLiveSpan>() {});
259258
schemas.put("WidgetNewFixedSpan", new GenericType<WidgetNewFixedSpan>() {});
259+
schemas.put("WidgetLegacyLiveSpan", new GenericType<WidgetLegacyLiveSpan>() {});
260260
JSON.registerDescendants(WidgetTime.class, Collections.unmodifiableMap(schemas));
261261
}
262262

@@ -267,22 +267,22 @@ public Map<String, GenericType> getSchemas() {
267267

268268
/**
269269
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
270-
* against the oneOf child schemas: WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan
270+
* against the oneOf child schemas: WidgetNewLiveSpan, WidgetNewFixedSpan, WidgetLegacyLiveSpan
271271
*
272272
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
273273
* composed schema (allOf, anyOf, oneOf).
274274
*/
275275
@Override
276276
public void setActualInstance(Object instance) {
277-
if (JSON.isInstanceOf(WidgetLegacyLiveSpan.class, instance, new HashSet<Class<?>>())) {
277+
if (JSON.isInstanceOf(WidgetNewLiveSpan.class, instance, new HashSet<Class<?>>())) {
278278
super.setActualInstance(instance);
279279
return;
280280
}
281-
if (JSON.isInstanceOf(WidgetNewLiveSpan.class, instance, new HashSet<Class<?>>())) {
281+
if (JSON.isInstanceOf(WidgetNewFixedSpan.class, instance, new HashSet<Class<?>>())) {
282282
super.setActualInstance(instance);
283283
return;
284284
}
285-
if (JSON.isInstanceOf(WidgetNewFixedSpan.class, instance, new HashSet<Class<?>>())) {
285+
if (JSON.isInstanceOf(WidgetLegacyLiveSpan.class, instance, new HashSet<Class<?>>())) {
286286
super.setActualInstance(instance);
287287
return;
288288
}
@@ -292,32 +292,21 @@ public void setActualInstance(Object instance) {
292292
return;
293293
}
294294
throw new RuntimeException(
295-
"Invalid instance type. Must be WidgetLegacyLiveSpan, WidgetNewLiveSpan,"
296-
+ " WidgetNewFixedSpan");
295+
"Invalid instance type. Must be WidgetNewLiveSpan, WidgetNewFixedSpan,"
296+
+ " WidgetLegacyLiveSpan");
297297
}
298298

299299
/**
300-
* Get the actual instance, which can be the following: WidgetLegacyLiveSpan, WidgetNewLiveSpan,
301-
* WidgetNewFixedSpan
300+
* Get the actual instance, which can be the following: WidgetNewLiveSpan, WidgetNewFixedSpan,
301+
* WidgetLegacyLiveSpan
302302
*
303-
* @return The actual instance (WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan)
303+
* @return The actual instance (WidgetNewLiveSpan, WidgetNewFixedSpan, WidgetLegacyLiveSpan)
304304
*/
305305
@Override
306306
public Object getActualInstance() {
307307
return super.getActualInstance();
308308
}
309309

310-
/**
311-
* Get the actual instance of `WidgetLegacyLiveSpan`. If the actual instance is not
312-
* `WidgetLegacyLiveSpan`, the ClassCastException will be thrown.
313-
*
314-
* @return The actual instance of `WidgetLegacyLiveSpan`
315-
* @throws ClassCastException if the instance is not `WidgetLegacyLiveSpan`
316-
*/
317-
public WidgetLegacyLiveSpan getWidgetLegacyLiveSpan() throws ClassCastException {
318-
return (WidgetLegacyLiveSpan) super.getActualInstance();
319-
}
320-
321310
/**
322311
* Get the actual instance of `WidgetNewLiveSpan`. If the actual instance is not
323312
* `WidgetNewLiveSpan`, the ClassCastException will be thrown.
@@ -339,4 +328,15 @@ public WidgetNewLiveSpan getWidgetNewLiveSpan() throws ClassCastException {
339328
public WidgetNewFixedSpan getWidgetNewFixedSpan() throws ClassCastException {
340329
return (WidgetNewFixedSpan) super.getActualInstance();
341330
}
331+
332+
/**
333+
* Get the actual instance of `WidgetLegacyLiveSpan`. If the actual instance is not
334+
* `WidgetLegacyLiveSpan`, the ClassCastException will be thrown.
335+
*
336+
* @return The actual instance of `WidgetLegacyLiveSpan`
337+
* @throws ClassCastException if the instance is not `WidgetLegacyLiveSpan`
338+
*/
339+
public WidgetLegacyLiveSpan getWidgetLegacyLiveSpan() throws ClassCastException {
340+
return (WidgetLegacyLiveSpan) super.getActualInstance();
341+
}
342342
}

0 commit comments

Comments
 (0)