Skip to content

Commit 078777c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 5d86661b of spec repo (#2935)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent c939c5a commit 078777c

File tree

5 files changed

+302
-10
lines changed

5 files changed

+302
-10
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": "2025-06-24 13:19:24.897822",
8-
"spec_repo_commit": "8772660e"
7+
"regenerated": "2025-06-25 11:39:38.389684",
8+
"spec_repo_commit": "5d86661b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-24 13:19:24.915653",
13-
"spec_repo_commit": "8772660e"
12+
"regenerated": "2025-06-25 11:39:38.406037",
13+
"spec_repo_commit": "5d86661b"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17201,8 +17201,8 @@ components:
1720117201
description: DNS server to use for DNS tests.
1720217202
type: string
1720317203
dnsServerPort:
17204+
$ref: '#/components/schemas/SyntheticsTestRequestDNSServerPort'
1720417205
description: DNS server port to use for DNS tests.
17205-
type: string
1720617206
files:
1720717207
description: Files to be used as part of the request in the test. Only valid
1720817208
if `bodyType` is `multipart/form-data`.
@@ -17356,6 +17356,15 @@ components:
1735617356
description: Date of update of the certificate or key, ISO format.
1735717357
type: string
1735817358
type: object
17359+
SyntheticsTestRequestDNSServerPort:
17360+
description: DNS server port to use for DNS tests.
17361+
oneOf:
17362+
- $ref: '#/components/schemas/SyntheticsTestRequestNumericalDNSServerPort'
17363+
- $ref: '#/components/schemas/SyntheticsTestRequestVariableDNSServerPort'
17364+
SyntheticsTestRequestNumericalDNSServerPort:
17365+
description: Integer DNS server port number to use when performing the test.
17366+
format: int64
17367+
type: integer
1735917368
SyntheticsTestRequestNumericalPort:
1736017369
description: Integer Port number to use when performing the test.
1736117370
format: int64
@@ -17377,6 +17386,10 @@ components:
1737717386
required:
1737817387
- url
1737917388
type: object
17389+
SyntheticsTestRequestVariableDNSServerPort:
17390+
description: String DNS server port number to use when performing the test.
17391+
Supports templated variables.
17392+
type: string
1738017393
SyntheticsTestRequestVariablePort:
1738117394
description: String Port number to use when performing the test. Supports templated
1738217395
variables.

examples/v1/synthetics/CreateSyntheticsAPITest_1279271422.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.datadog.api.client.v1.model.SyntheticsTestOptionsHTTPVersion;
3131
import com.datadog.api.client.v1.model.SyntheticsTestOptionsRetry;
3232
import com.datadog.api.client.v1.model.SyntheticsTestRequest;
33+
import com.datadog.api.client.v1.model.SyntheticsTestRequestDNSServerPort;
3334
import com.datadog.api.client.v1.model.SyntheticsTestRequestPort;
3435
import com.datadog.api.client.v1.model.SyntheticsVariableParser;
3536
import java.util.Arrays;
@@ -170,7 +171,8 @@ public static void main(String[] args) {
170171
new SyntheticsTestRequest()
171172
.host("troisdizaines.com")
172173
.dnsServer("8.8.8.8")
173-
.dnsServerPort("53"))),
174+
.dnsServerPort(
175+
new SyntheticsTestRequestDNSServerPort("53")))),
174176
new SyntheticsAPIStep(
175177
new SyntheticsAPITestStep()
176178
.name("TCP step")

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public class SyntheticsTestRequest {
9393
private String dnsServer;
9494

9595
public static final String JSON_PROPERTY_DNS_SERVER_PORT = "dnsServerPort";
96-
private String dnsServerPort;
96+
private SyntheticsTestRequestDNSServerPort dnsServerPort;
9797

9898
public static final String JSON_PROPERTY_FILES = "files";
9999
private List<SyntheticsTestRequestBodyFile> files = null;
@@ -409,8 +409,9 @@ public void setDnsServer(String dnsServer) {
409409
this.dnsServer = dnsServer;
410410
}
411411

412-
public SyntheticsTestRequest dnsServerPort(String dnsServerPort) {
412+
public SyntheticsTestRequest dnsServerPort(SyntheticsTestRequestDNSServerPort dnsServerPort) {
413413
this.dnsServerPort = dnsServerPort;
414+
this.unparsed |= dnsServerPort.unparsed;
414415
return this;
415416
}
416417

@@ -422,11 +423,11 @@ public SyntheticsTestRequest dnsServerPort(String dnsServerPort) {
422423
@jakarta.annotation.Nullable
423424
@JsonProperty(JSON_PROPERTY_DNS_SERVER_PORT)
424425
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
425-
public String getDnsServerPort() {
426+
public SyntheticsTestRequestDNSServerPort getDnsServerPort() {
426427
return dnsServerPort;
427428
}
428429

429-
public void setDnsServerPort(String dnsServerPort) {
430+
public void setDnsServerPort(SyntheticsTestRequestDNSServerPort dnsServerPort) {
430431
this.dnsServerPort = dnsServerPort;
431432
}
432433

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
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.v1.model;
8+
9+
import com.datadog.api.client.AbstractOpenApiSchema;
10+
import com.datadog.api.client.JSON;
11+
import com.datadog.api.client.UnparsedObject;
12+
import com.fasterxml.jackson.annotation.JsonIgnore;
13+
import com.fasterxml.jackson.core.JsonGenerator;
14+
import com.fasterxml.jackson.core.JsonParser;
15+
import com.fasterxml.jackson.core.JsonProcessingException;
16+
import com.fasterxml.jackson.core.JsonToken;
17+
import com.fasterxml.jackson.core.type.TypeReference;
18+
import com.fasterxml.jackson.databind.DeserializationContext;
19+
import com.fasterxml.jackson.databind.JsonMappingException;
20+
import com.fasterxml.jackson.databind.JsonNode;
21+
import com.fasterxml.jackson.databind.MapperFeature;
22+
import com.fasterxml.jackson.databind.ObjectMapper;
23+
import com.fasterxml.jackson.databind.SerializerProvider;
24+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
25+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
26+
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
27+
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
28+
import jakarta.ws.rs.core.GenericType;
29+
import java.io.IOException;
30+
import java.util.Collections;
31+
import java.util.HashMap;
32+
import java.util.HashSet;
33+
import java.util.Map;
34+
import java.util.logging.Level;
35+
import java.util.logging.Logger;
36+
37+
@jakarta.annotation.Generated(
38+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
39+
@JsonDeserialize(
40+
using = SyntheticsTestRequestDNSServerPort.SyntheticsTestRequestDNSServerPortDeserializer.class)
41+
@JsonSerialize(
42+
using = SyntheticsTestRequestDNSServerPort.SyntheticsTestRequestDNSServerPortSerializer.class)
43+
public class SyntheticsTestRequestDNSServerPort extends AbstractOpenApiSchema {
44+
private static final Logger log =
45+
Logger.getLogger(SyntheticsTestRequestDNSServerPort.class.getName());
46+
47+
@JsonIgnore public boolean unparsed = false;
48+
49+
public static class SyntheticsTestRequestDNSServerPortSerializer
50+
extends StdSerializer<SyntheticsTestRequestDNSServerPort> {
51+
public SyntheticsTestRequestDNSServerPortSerializer(
52+
Class<SyntheticsTestRequestDNSServerPort> t) {
53+
super(t);
54+
}
55+
56+
public SyntheticsTestRequestDNSServerPortSerializer() {
57+
this(null);
58+
}
59+
60+
@Override
61+
public void serialize(
62+
SyntheticsTestRequestDNSServerPort value, JsonGenerator jgen, SerializerProvider provider)
63+
throws IOException, JsonProcessingException {
64+
jgen.writeObject(value.getActualInstance());
65+
}
66+
}
67+
68+
public static class SyntheticsTestRequestDNSServerPortDeserializer
69+
extends StdDeserializer<SyntheticsTestRequestDNSServerPort> {
70+
public SyntheticsTestRequestDNSServerPortDeserializer() {
71+
this(SyntheticsTestRequestDNSServerPort.class);
72+
}
73+
74+
public SyntheticsTestRequestDNSServerPortDeserializer(Class<?> vc) {
75+
super(vc);
76+
}
77+
78+
@Override
79+
public SyntheticsTestRequestDNSServerPort deserialize(
80+
JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
81+
JsonNode tree = jp.readValueAsTree();
82+
Object deserialized = null;
83+
Object tmp = null;
84+
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
85+
int match = 0;
86+
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
87+
// deserialize Long
88+
try {
89+
boolean attemptParsing = true;
90+
// ensure that we respect type coercion as set on the client ObjectMapper
91+
if (Long.class.equals(Integer.class)
92+
|| Long.class.equals(Long.class)
93+
|| Long.class.equals(Float.class)
94+
|| Long.class.equals(Double.class)
95+
|| Long.class.equals(Boolean.class)
96+
|| Long.class.equals(String.class)) {
97+
attemptParsing = typeCoercion;
98+
if (!attemptParsing) {
99+
attemptParsing |=
100+
((Long.class.equals(Integer.class) || Long.class.equals(Long.class))
101+
&& token == JsonToken.VALUE_NUMBER_INT);
102+
attemptParsing |=
103+
((Long.class.equals(Float.class) || Long.class.equals(Double.class))
104+
&& (token == JsonToken.VALUE_NUMBER_FLOAT
105+
|| token == JsonToken.VALUE_NUMBER_INT));
106+
attemptParsing |=
107+
(Long.class.equals(Boolean.class)
108+
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
109+
attemptParsing |= (Long.class.equals(String.class) && token == JsonToken.VALUE_STRING);
110+
}
111+
}
112+
if (attemptParsing) {
113+
tmp = tree.traverse(jp.getCodec()).readValueAs(Long.class);
114+
// TODO: there is no validation against JSON schema constraints
115+
// (min, max, enum, pattern...), this does not perform a strict JSON
116+
// validation, which means the 'match' count may be higher than it should be.
117+
deserialized = tmp;
118+
match++;
119+
120+
log.log(Level.FINER, "Input data matches schema 'Long'");
121+
}
122+
} catch (Exception e) {
123+
// deserialization failed, continue
124+
log.log(Level.FINER, "Input data does not match schema 'Long'", e);
125+
}
126+
127+
// deserialize String
128+
try {
129+
boolean attemptParsing = true;
130+
// ensure that we respect type coercion as set on the client ObjectMapper
131+
if (String.class.equals(Integer.class)
132+
|| String.class.equals(Long.class)
133+
|| String.class.equals(Float.class)
134+
|| String.class.equals(Double.class)
135+
|| String.class.equals(Boolean.class)
136+
|| String.class.equals(String.class)) {
137+
attemptParsing = typeCoercion;
138+
if (!attemptParsing) {
139+
attemptParsing |=
140+
((String.class.equals(Integer.class) || String.class.equals(Long.class))
141+
&& token == JsonToken.VALUE_NUMBER_INT);
142+
attemptParsing |=
143+
((String.class.equals(Float.class) || String.class.equals(Double.class))
144+
&& (token == JsonToken.VALUE_NUMBER_FLOAT
145+
|| token == JsonToken.VALUE_NUMBER_INT));
146+
attemptParsing |=
147+
(String.class.equals(Boolean.class)
148+
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
149+
attemptParsing |=
150+
(String.class.equals(String.class) && token == JsonToken.VALUE_STRING);
151+
}
152+
}
153+
if (attemptParsing) {
154+
tmp = tree.traverse(jp.getCodec()).readValueAs(String.class);
155+
// TODO: there is no validation against JSON schema constraints
156+
// (min, max, enum, pattern...), this does not perform a strict JSON
157+
// validation, which means the 'match' count may be higher than it should be.
158+
deserialized = tmp;
159+
match++;
160+
161+
log.log(Level.FINER, "Input data matches schema 'String'");
162+
}
163+
} catch (Exception e) {
164+
// deserialization failed, continue
165+
log.log(Level.FINER, "Input data does not match schema 'String'", e);
166+
}
167+
168+
SyntheticsTestRequestDNSServerPort ret = new SyntheticsTestRequestDNSServerPort();
169+
if (match == 1) {
170+
ret.setActualInstance(deserialized);
171+
} else {
172+
Map<String, Object> res =
173+
new ObjectMapper()
174+
.readValue(
175+
tree.traverse(jp.getCodec()).readValueAsTree().toString(),
176+
new TypeReference<Map<String, Object>>() {});
177+
ret.setActualInstance(new UnparsedObject(res));
178+
}
179+
return ret;
180+
}
181+
182+
/** Handle deserialization of the 'null' value. */
183+
@Override
184+
public SyntheticsTestRequestDNSServerPort getNullValue(DeserializationContext ctxt)
185+
throws JsonMappingException {
186+
throw new JsonMappingException(
187+
ctxt.getParser(), "SyntheticsTestRequestDNSServerPort cannot be null");
188+
}
189+
}
190+
191+
// store a list of schema names defined in oneOf
192+
public static final Map<String, GenericType> schemas = new HashMap<String, GenericType>();
193+
194+
public SyntheticsTestRequestDNSServerPort() {
195+
super("oneOf", Boolean.FALSE);
196+
}
197+
198+
public SyntheticsTestRequestDNSServerPort(Long o) {
199+
super("oneOf", Boolean.FALSE);
200+
setActualInstance(o);
201+
}
202+
203+
public SyntheticsTestRequestDNSServerPort(String o) {
204+
super("oneOf", Boolean.FALSE);
205+
setActualInstance(o);
206+
}
207+
208+
static {
209+
schemas.put("Long", new GenericType<Long>() {});
210+
schemas.put("String", new GenericType<String>() {});
211+
JSON.registerDescendants(
212+
SyntheticsTestRequestDNSServerPort.class, Collections.unmodifiableMap(schemas));
213+
}
214+
215+
@Override
216+
public Map<String, GenericType> getSchemas() {
217+
return SyntheticsTestRequestDNSServerPort.schemas;
218+
}
219+
220+
/**
221+
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
222+
* against the oneOf child schemas: Long, String
223+
*
224+
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
225+
* composed schema (allOf, anyOf, oneOf).
226+
*/
227+
@Override
228+
public void setActualInstance(Object instance) {
229+
if (JSON.isInstanceOf(Long.class, instance, new HashSet<Class<?>>())) {
230+
super.setActualInstance(instance);
231+
return;
232+
}
233+
if (JSON.isInstanceOf(String.class, instance, new HashSet<Class<?>>())) {
234+
super.setActualInstance(instance);
235+
return;
236+
}
237+
238+
if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
239+
super.setActualInstance(instance);
240+
return;
241+
}
242+
throw new RuntimeException("Invalid instance type. Must be Long, String");
243+
}
244+
245+
/**
246+
* Get the actual instance, which can be the following: Long, String
247+
*
248+
* @return The actual instance (Long, String)
249+
*/
250+
@Override
251+
public Object getActualInstance() {
252+
return super.getActualInstance();
253+
}
254+
255+
/**
256+
* Get the actual instance of `Long`. If the actual instance is not `Long`, the ClassCastException
257+
* will be thrown.
258+
*
259+
* @return The actual instance of `Long`
260+
* @throws ClassCastException if the instance is not `Long`
261+
*/
262+
public Long getLong() throws ClassCastException {
263+
return (Long) super.getActualInstance();
264+
}
265+
266+
/**
267+
* Get the actual instance of `String`. If the actual instance is not `String`, the
268+
* ClassCastException will be thrown.
269+
*
270+
* @return The actual instance of `String`
271+
* @throws ClassCastException if the instance is not `String`
272+
*/
273+
public String getString() throws ClassCastException {
274+
return (String) super.getActualInstance();
275+
}
276+
}

0 commit comments

Comments
 (0)