Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Change type to enum to discriminate included items in the response of ListCatalogEntity #2768

Merged
merged 1 commit into from
Mar 24, 2025
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-03-20 15:01:18.145313",
"spec_repo_commit": "0f5c928e"
"regenerated": "2025-03-24 14:58:29.224495",
"spec_repo_commit": "764de5f0"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-03-20 15:01:18.161824",
"spec_repo_commit": "0f5c928e"
"regenerated": "2025-03-24 14:58:29.240267",
"spec_repo_commit": "764de5f0"
}
}
}
50 changes: 40 additions & 10 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11936,9 +11936,15 @@ components:
description: Incident ID.
type: string
type:
description: Incident description.
type: string
$ref: '#/components/schemas/EntityResponseIncludedIncidentType'
type: object
EntityResponseIncludedIncidentType:
description: Incident description.
enum:
- incident
type: string
x-enum-varnames:
- INCIDENT
EntityResponseIncludedOncall:
description: Included oncall.
properties:
Expand All @@ -11948,9 +11954,15 @@ components:
description: Oncall ID.
type: string
type:
description: Oncall type.
type: string
$ref: '#/components/schemas/EntityResponseIncludedOncallType'
type: object
EntityResponseIncludedOncallType:
description: Oncall type.
enum:
- oncall
type: string
x-enum-varnames:
- ONCALL
EntityResponseIncludedRawSchema:
description: Included raw schema.
properties:
Expand All @@ -11960,8 +11972,7 @@ components:
description: Raw schema ID.
type: string
type:
description: Raw schema type.
type: string
$ref: '#/components/schemas/EntityResponseIncludedRawSchemaType'
type: object
EntityResponseIncludedRawSchemaAttributes:
description: Included raw schema attributes.
Expand All @@ -11970,6 +11981,13 @@ components:
description: Schema from user input in base64 encoding.
type: string
type: object
EntityResponseIncludedRawSchemaType:
description: Raw schema type.
enum:
- rawSchema
type: string
x-enum-varnames:
- RAW_SCHEMA
EntityResponseIncludedRelatedEntity:
description: Included related entity.
properties:
Expand All @@ -11981,8 +11999,7 @@ components:
meta:
$ref: '#/components/schemas/EntityResponseIncludedRelatedEntityMeta'
type:
description: Related entity.
type: string
$ref: '#/components/schemas/EntityResponseIncludedRelatedEntityType'
type: object
EntityResponseIncludedRelatedEntityAttributes:
description: Related entity attributes.
Expand Down Expand Up @@ -12018,6 +12035,13 @@ components:
description: Entity relation source.
type: string
type: object
EntityResponseIncludedRelatedEntityType:
description: Related entity.
enum:
- relatedEntity
type: string
x-enum-varnames:
- RELATED_ENTITY
EntityResponseIncludedRelatedIncidentAttributes:
description: Incident attributes.
properties:
Expand Down Expand Up @@ -12075,15 +12099,21 @@ components:
description: Entity ID.
type: string
type:
description: Schema type.
type: string
$ref: '#/components/schemas/EntityResponseIncludedSchemaType'
type: object
EntityResponseIncludedSchemaAttributes:
description: Included schema.
properties:
schema:
$ref: '#/components/schemas/EntityV3'
type: object
EntityResponseIncludedSchemaType:
description: Schema type.
enum:
- schema
type: string
x-enum-varnames:
- SCHEMA
EntityResponseMeta:
description: Entity metadata.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class EntityResponseIncludedIncident {
private String id;

public static final String JSON_PROPERTY_TYPE = "type";
private String type;
private EntityResponseIncludedIncidentType type;

public EntityResponseIncludedIncident attributes(
EntityResponseIncludedRelatedIncidentAttributes attributes) {
Expand Down Expand Up @@ -79,8 +79,9 @@ public void setId(String id) {
this.id = id;
}

public EntityResponseIncludedIncident type(String type) {
public EntityResponseIncludedIncident type(EntityResponseIncludedIncidentType type) {
this.type = type;
this.unparsed |= !type.isValid();
return this;
}

Expand All @@ -92,11 +93,14 @@ public EntityResponseIncludedIncident type(String type) {
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getType() {
public EntityResponseIncludedIncidentType getType() {
return type;
}

public void setType(String type) {
public void setType(EntityResponseIncludedIncidentType type) {
if (!type.isValid()) {
this.unparsed = true;
}
this.type = type;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v2.model;

import com.datadog.api.client.ModelEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/** Incident description. */
@JsonSerialize(
using = EntityResponseIncludedIncidentType.EntityResponseIncludedIncidentTypeSerializer.class)
public class EntityResponseIncludedIncidentType extends ModelEnum<String> {

private static final Set<String> allowedValues = new HashSet<String>(Arrays.asList("incident"));

public static final EntityResponseIncludedIncidentType INCIDENT =
new EntityResponseIncludedIncidentType("incident");

EntityResponseIncludedIncidentType(String value) {
super(value, allowedValues);
}

public static class EntityResponseIncludedIncidentTypeSerializer
extends StdSerializer<EntityResponseIncludedIncidentType> {
public EntityResponseIncludedIncidentTypeSerializer(
Class<EntityResponseIncludedIncidentType> t) {
super(t);
}

public EntityResponseIncludedIncidentTypeSerializer() {
this(null);
}

@Override
public void serialize(
EntityResponseIncludedIncidentType value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
jgen.writeObject(value.value);
}
}

@JsonCreator
public static EntityResponseIncludedIncidentType fromValue(String value) {
return new EntityResponseIncludedIncidentType(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class EntityResponseIncludedOncall {
private String id;

public static final String JSON_PROPERTY_TYPE = "type";
private String type;
private EntityResponseIncludedOncallType type;

public EntityResponseIncludedOncall attributes(
EntityResponseIncludedRelatedOncallAttributes attributes) {
Expand Down Expand Up @@ -79,8 +79,9 @@ public void setId(String id) {
this.id = id;
}

public EntityResponseIncludedOncall type(String type) {
public EntityResponseIncludedOncall type(EntityResponseIncludedOncallType type) {
this.type = type;
this.unparsed |= !type.isValid();
return this;
}

Expand All @@ -92,11 +93,14 @@ public EntityResponseIncludedOncall type(String type) {
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getType() {
public EntityResponseIncludedOncallType getType() {
return type;
}

public void setType(String type) {
public void setType(EntityResponseIncludedOncallType type) {
if (!type.isValid()) {
this.unparsed = true;
}
this.type = type;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v2.model;

import com.datadog.api.client.ModelEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/** Oncall type. */
@JsonSerialize(
using = EntityResponseIncludedOncallType.EntityResponseIncludedOncallTypeSerializer.class)
public class EntityResponseIncludedOncallType extends ModelEnum<String> {

private static final Set<String> allowedValues = new HashSet<String>(Arrays.asList("oncall"));

public static final EntityResponseIncludedOncallType ONCALL =
new EntityResponseIncludedOncallType("oncall");

EntityResponseIncludedOncallType(String value) {
super(value, allowedValues);
}

public static class EntityResponseIncludedOncallTypeSerializer
extends StdSerializer<EntityResponseIncludedOncallType> {
public EntityResponseIncludedOncallTypeSerializer(Class<EntityResponseIncludedOncallType> t) {
super(t);
}

public EntityResponseIncludedOncallTypeSerializer() {
this(null);
}

@Override
public void serialize(
EntityResponseIncludedOncallType value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
jgen.writeObject(value.value);
}
}

@JsonCreator
public static EntityResponseIncludedOncallType fromValue(String value) {
return new EntityResponseIncludedOncallType(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class EntityResponseIncludedRawSchema {
private String id;

public static final String JSON_PROPERTY_TYPE = "type";
private String type;
private EntityResponseIncludedRawSchemaType type;

public EntityResponseIncludedRawSchema attributes(
EntityResponseIncludedRawSchemaAttributes attributes) {
Expand Down Expand Up @@ -79,8 +79,9 @@ public void setId(String id) {
this.id = id;
}

public EntityResponseIncludedRawSchema type(String type) {
public EntityResponseIncludedRawSchema type(EntityResponseIncludedRawSchemaType type) {
this.type = type;
this.unparsed |= !type.isValid();
return this;
}

Expand All @@ -92,11 +93,14 @@ public EntityResponseIncludedRawSchema type(String type) {
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getType() {
public EntityResponseIncludedRawSchemaType getType() {
return type;
}

public void setType(String type) {
public void setType(EntityResponseIncludedRawSchemaType type) {
if (!type.isValid()) {
this.unparsed = true;
}
this.type = type;
}

Expand Down
Loading