Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-31 15:03:13.227560",
"spec_repo_commit": "b01f90f4"
"regenerated": "2025-02-03 15:48:15.993458",
"spec_repo_commit": "d6014add"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-31 15:03:13.242731",
"spec_repo_commit": "b01f90f4"
"regenerated": "2025-02-03 15:48:16.009612",
"spec_repo_commit": "d6014add"
}
}
}
93 changes: 93 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10524,6 +10524,99 @@ components:
- $ref: '#/components/schemas/EntityV3Datastore'
- $ref: '#/components/schemas/EntityV3Queue'
- $ref: '#/components/schemas/EntityV3System'
- $ref: '#/components/schemas/EntityV3API'
EntityV3API:
additionalProperties: false
description: Schema for API entities.
properties:
apiVersion:
$ref: '#/components/schemas/EntityV3APIVersion'
datadog:
$ref: '#/components/schemas/EntityV3APIDatadog'
extensions:
additionalProperties: {}
description: Custom extensions. This is the free-formed field to send client-side
metadata. No Datadog features are affected by this field.
type: object
integrations:
$ref: '#/components/schemas/EntityV3Integrations'
kind:
$ref: '#/components/schemas/EntityV3APIKind'
metadata:
$ref: '#/components/schemas/EntityV3Metadata'
spec:
$ref: '#/components/schemas/EntityV3APISpec'
required:
- apiVersion
- kind
- metadata
type: object
EntityV3APIDatadog:
additionalProperties: false
description: Datadog product integrations for the API entity.
properties:
codeLocations:
$ref: '#/components/schemas/EntityV3DatadogCodeLocations'
events:
$ref: '#/components/schemas/EntityV3DatadogEvents'
logs:
$ref: '#/components/schemas/EntityV3DatadogLogs'
performanceData:
$ref: '#/components/schemas/EntityV3DatadogPerformance'
pipelines:
$ref: '#/components/schemas/EntityV3DatadogPipelines'
type: object
EntityV3APIKind:
description: The definition of Entity V3 API Kind object.
enum:
- api
example: api
type: string
x-enum-varnames:
- API
EntityV3APISpec:
additionalProperties: false
description: The definition of Entity V3 API Spec object.
properties:
implementedBy:
description: Services which implemented the API.
items:
type: string
type: array
interface:
$ref: '#/components/schemas/EntityV3APISpecInterface'
lifecycle:
description: The lifecycle state of the component.
minLength: 1
type: string
tier:
description: The importance of the component.
minLength: 1
type: string
type:
description: The type of API.
type: string
type: object
EntityV3APISpecInterface:
additionalProperties: false
description: The API definition.
oneOf:
- $ref: '#/components/schemas/EntityV3APISpecInterfaceFileRef'
- $ref: '#/components/schemas/EntityV3APISpecInterfaceDefinition'
EntityV3APISpecInterfaceDefinition:
additionalProperties: false
description: The definition of `EntityV3APISpecInterfaceDefinition` object.
properties:
definition:
description: The API definition.
type: object
EntityV3APISpecInterfaceFileRef:
additionalProperties: false
description: The definition of `EntityV3APISpecInterfaceFileRef` object.
properties:
fileRef:
description: The reference to the API definition file.
type: string
EntityV3APIVersion:
description: The schema version of entity type. The field is known as schema-version
in the previous version.
Expand Down
72 changes: 68 additions & 4 deletions src/main/java/com/datadog/api/client/v2/model/EntityV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,48 @@ public EntityV3 deserialize(JsonParser jp, DeserializationContext ctxt)
log.log(Level.FINER, "Input data does not match schema 'EntityV3System'", e);
}

// deserialize EntityV3API
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (EntityV3API.class.equals(Integer.class)
|| EntityV3API.class.equals(Long.class)
|| EntityV3API.class.equals(Float.class)
|| EntityV3API.class.equals(Double.class)
|| EntityV3API.class.equals(Boolean.class)
|| EntityV3API.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((EntityV3API.class.equals(Integer.class) || EntityV3API.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((EntityV3API.class.equals(Float.class) || EntityV3API.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(EntityV3API.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(EntityV3API.class.equals(String.class) && token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(EntityV3API.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
if (!((EntityV3API) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'EntityV3API'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'EntityV3API'", e);
}

EntityV3 ret = new EntityV3();
if (match == 1) {
ret.setActualInstance(deserialized);
Expand Down Expand Up @@ -301,11 +343,17 @@ public EntityV3(EntityV3System o) {
setActualInstance(o);
}

public EntityV3(EntityV3API o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

static {
schemas.put("EntityV3Service", new GenericType<EntityV3Service>() {});
schemas.put("EntityV3Datastore", new GenericType<EntityV3Datastore>() {});
schemas.put("EntityV3Queue", new GenericType<EntityV3Queue>() {});
schemas.put("EntityV3System", new GenericType<EntityV3System>() {});
schemas.put("EntityV3API", new GenericType<EntityV3API>() {});
JSON.registerDescendants(EntityV3.class, Collections.unmodifiableMap(schemas));
}

Expand All @@ -317,7 +365,7 @@ public Map<String, GenericType> getSchemas() {
/**
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: EntityV3Service, EntityV3Datastore, EntityV3Queue,
* EntityV3System
* EntityV3System, EntityV3API
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand All @@ -340,21 +388,26 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(EntityV3API.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}
throw new RuntimeException(
"Invalid instance type. Must be EntityV3Service, EntityV3Datastore, EntityV3Queue,"
+ " EntityV3System");
+ " EntityV3System, EntityV3API");
}

/**
* Get the actual instance, which can be the following: EntityV3Service, EntityV3Datastore,
* EntityV3Queue, EntityV3System
* EntityV3Queue, EntityV3System, EntityV3API
*
* @return The actual instance (EntityV3Service, EntityV3Datastore, EntityV3Queue, EntityV3System)
* @return The actual instance (EntityV3Service, EntityV3Datastore, EntityV3Queue, EntityV3System,
* EntityV3API)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -404,4 +457,15 @@ public EntityV3Queue getEntityV3Queue() throws ClassCastException {
public EntityV3System getEntityV3System() throws ClassCastException {
return (EntityV3System) super.getActualInstance();
}

/**
* Get the actual instance of `EntityV3API`. If the actual instance is not `EntityV3API`, the
* ClassCastException will be thrown.
*
* @return The actual instance of `EntityV3API`
* @throws ClassCastException if the instance is not `EntityV3API`
*/
public EntityV3API getEntityV3API() throws ClassCastException {
return (EntityV3API) super.getActualInstance();
}
}
Loading