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
18 changes: 9 additions & 9 deletions .generator/src/generator/templates/modelSimple.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
public static final String JSON_PROPERTY_{{ attr|snake_case|upper }} = "{{ attr }}";

{%- if not isRequired and isNullable %}
{%- if "items" in schema or schema.additionalProperties is defined or (schema.type is not defined and "oneOf" not in schema) %}
{%- if "items" in schema or (schema.additionalProperties is defined and schema.additionalProperties is not false) or (schema.type is not defined and "oneOf" not in schema) %}
private JsonNullable<{{ dataType }}> {{ variableName }} = JsonNullable.<{{ dataType }}>undefined();
{%- else %}
private JsonNullable<{{ dataType }}> {{ variableName }} = JsonNullable.<{{ dataType }}>{%- if defaultValue != None %}of({{ defaultValue|format_value(schema=schema, default_value=True, type_=dataType) }}){%- else %}undefined(){%- endif%};
{%- endif %}
{%- else %}
{%- if "items" in schema %}
private {{ dataType }} {{ variableName }}{%- if isRequired %} = new ArrayList<>(){%- else %} = null{%- endif %};
{%- elif schema.additionalProperties is defined or (not schema.get("type") and "oneOf" not in schema) %}
{%- elif (schema.additionalProperties is defined and schema.additionalProperties is not false) or (not schema.get("type") and "oneOf" not in schema) %}
private {{ dataType }} {{ variableName }}{%- if isRequired %} = new {{ dataType }}(){%- else %} = null{%- endif %};
{%- else %}
private {{ dataType }} {{ variableName }}{%- if defaultValue != None %} = {{ defaultValue|format_value(schema=schema, default_value=True, type_=dataType) }}{%- endif %};
Expand Down Expand Up @@ -211,7 +211,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
{%- else %}
@JsonProperty(JSON_PROPERTY_{{ attr|snake_case|upper }})
@JsonInclude(
{%- if schema.additionalProperties %}{%- if schema.additionalProperties.nullable %}content = JsonInclude.Include.ALWAYS,{%- endif %}{%- endif %}
{%- if schema.additionalProperties is defined and schema.additionalProperties is not false %}{%- if schema.additionalProperties.nullable %}content = JsonInclude.Include.ALWAYS,{%- endif %}{%- endif %}
value = JsonInclude.Include.{%- if isRequired %}ALWAYS{%- else %}USE_DEFAULTS{%- endif %})
{%- endif %}
public {{ dataType }} get{{ attr|camel_case|upperfirst }}() {
Expand All @@ -233,7 +233,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
{%- if not isRequired and isNullable %}
@JsonProperty(JSON_PROPERTY_{{ attr|snake_case|upper }})
@JsonInclude(
{%- if schema.additionalProperties %}{%- if schema.additionalProperties.nullable %}content = JsonInclude.Include.ALWAYS,{%- endif %}{%- endif %}
{%- if schema.additionalProperties is defined and schema.additionalProperties is not false %}{%- if schema.additionalProperties.nullable %}content = JsonInclude.Include.ALWAYS,{%- endif %}{%- endif %}
value = JsonInclude.Include.{%- if isRequired %}ALWAYS{%- else %}USE_DEFAULTS{%- endif %})
public JsonNullable<{{ dataType }}> get{{ attr|camel_case|upperfirst }}_JsonNullable() {
return {{ variableName }};
Expand All @@ -259,7 +259,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
}
{%- endif %}
{%- endfor %}
{%- if model.get("additionalProperties", True) %}
{%- if model.additionalProperties is not false %}
{%- set additionalPropertiesDataType = model.get("additionalProperties", {})|simple_type or "Object" %}

/**
Expand Down Expand Up @@ -323,7 +323,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
}
{%- if model.properties is defined %}
{{ name }} {{ name|variable_name }} = ({{ name }}) o;
return {%- for attr, schema in model.get("properties").items() %} Objects.equals(this.{{ attr|variable_name }}, {{ name|variable_name }}.{{ attr|variable_name }}){%- if loop.nextitem or model.get("additionalProperties", True) %} &&{%- endif %}{%- endfor %}{% if model.get("additionalProperties", True) %} Objects.equals(this.additionalProperties, {{ name|variable_name }}.additionalProperties){% endif %}
return {%- for attr, schema in model.get("properties").items() %} Objects.equals(this.{{ attr|variable_name }}, {{ name|variable_name }}.{{ attr|variable_name }}){%- if loop.nextitem or model.additionalProperties is not false %} &&{%- endif %}{%- endfor %}{% if model.additionalProperties is not false %} Objects.equals(this.additionalProperties, {{ name|variable_name }}.additionalProperties){% endif %}
{%- if model.get("x-generate-alias-as-model") %} &&
super.equals(o){%- endif %};
{%- else %}
Expand All @@ -335,8 +335,8 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
@Override
public int hashCode() {
return Objects.hash({%- for attr, schema in model.get("properties", {}).items() %}{{ attr|variable_name }}{%- if loop.nextitem %}, {%- endif %}{%-endfor %}
{%- if model.get("additionalProperties", True) %}{%- if model.properties is defined %}, {%- endif %} additionalProperties{%- endif %}
{%- if model.get("x-generate-alias-as-model") %}{%- if model.properties is defined or model.get("additionalProperties", True) %}, {%- endif %}super.hashCode(){%- endif %});
{%- if model.additionalProperties is not false %}{%- if model.properties is defined %}, {%- endif %} additionalProperties{%- endif %}
{%- if model.get("x-generate-alias-as-model") %}{%- if model.properties is defined or model.additionalProperties is not false %}, {%- endif %}super.hashCode(){%- endif %});
}

@Override
Expand All @@ -349,7 +349,7 @@ public class {{ name }} {%- if model.get("x-generate-alias-as-model") %} extends
{%- for attr, schema in model.get("properties", {}).items() %}
sb.append(" {{ attr|variable_name }}: ").append(toIndentedString({{ attr|variable_name }})).append("\n");
{%- endfor %}
{%- if model.get("additionalProperties", True) %}
{%- if model.additionalProperties is not false %}
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class DetailedFindingAttributes {
private String message;

public static final String JSON_PROPERTY_MUTE = "mute";
private FindingMute mute = null;
private FindingMute mute;

public static final String JSON_PROPERTY_RESOURCE = "resource";
private String resource;
Expand All @@ -61,7 +61,7 @@ public class DetailedFindingAttributes {
private String resourceType;

public static final String JSON_PROPERTY_RULE = "rule";
private FindingRule rule = null;
private FindingRule rule;

public static final String JSON_PROPERTY_STATUS = "status";
private FindingStatus status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

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

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/** Object of the monitor identifier. */
Expand Down Expand Up @@ -50,6 +54,52 @@ public void setMonitorId(Long monitorId) {
this.monitorId = monitorId;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return DowntimeMonitorIdentifierId
*/
@JsonAnySetter
public DowntimeMonitorIdentifierId putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this DowntimeMonitorIdentifierId object is equal to o. */
@Override
public boolean equals(Object o) {
Expand All @@ -60,19 +110,24 @@ public boolean equals(Object o) {
return false;
}
DowntimeMonitorIdentifierId downtimeMonitorIdentifierId = (DowntimeMonitorIdentifierId) o;
return Objects.equals(this.monitorId, downtimeMonitorIdentifierId.monitorId);
return Objects.equals(this.monitorId, downtimeMonitorIdentifierId.monitorId)
&& Objects.equals(
this.additionalProperties, downtimeMonitorIdentifierId.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(monitorId);
return Objects.hash(monitorId, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DowntimeMonitorIdentifierId {\n");
sb.append(" monitorId: ").append(toIndentedString(monitorId)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@

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

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/** Object of the monitor tags. */
Expand Down Expand Up @@ -61,6 +65,52 @@ public void setMonitorTags(List<String> monitorTags) {
this.monitorTags = monitorTags;
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return DowntimeMonitorIdentifierTags
*/
@JsonAnySetter
public DowntimeMonitorIdentifierTags putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this DowntimeMonitorIdentifierTags object is equal to o. */
@Override
public boolean equals(Object o) {
Expand All @@ -71,19 +121,24 @@ public boolean equals(Object o) {
return false;
}
DowntimeMonitorIdentifierTags downtimeMonitorIdentifierTags = (DowntimeMonitorIdentifierTags) o;
return Objects.equals(this.monitorTags, downtimeMonitorIdentifierTags.monitorTags);
return Objects.equals(this.monitorTags, downtimeMonitorIdentifierTags.monitorTags)
&& Objects.equals(
this.additionalProperties, downtimeMonitorIdentifierTags.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(monitorTags);
return Objects.hash(monitorTags, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DowntimeMonitorIdentifierTags {\n");
sb.append(" monitorTags: ").append(toIndentedString(monitorTags)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@

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

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.openapitools.jackson.nullable.JsonNullable;

Expand Down Expand Up @@ -93,6 +97,53 @@ public void setStart(OffsetDateTime start) {
this.start = JsonNullable.<OffsetDateTime>of(start);
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return DowntimeScheduleOneTimeCreateUpdateRequest
*/
@JsonAnySetter
public DowntimeScheduleOneTimeCreateUpdateRequest putAdditionalProperty(
String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this DowntimeScheduleOneTimeCreateUpdateRequest object is equal to o. */
@Override
public boolean equals(Object o) {
Expand All @@ -105,12 +156,15 @@ public boolean equals(Object o) {
DowntimeScheduleOneTimeCreateUpdateRequest downtimeScheduleOneTimeCreateUpdateRequest =
(DowntimeScheduleOneTimeCreateUpdateRequest) o;
return Objects.equals(this.end, downtimeScheduleOneTimeCreateUpdateRequest.end)
&& Objects.equals(this.start, downtimeScheduleOneTimeCreateUpdateRequest.start);
&& Objects.equals(this.start, downtimeScheduleOneTimeCreateUpdateRequest.start)
&& Objects.equals(
this.additionalProperties,
downtimeScheduleOneTimeCreateUpdateRequest.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(end, start);
return Objects.hash(end, start, additionalProperties);
}

@Override
Expand All @@ -119,6 +173,9 @@ public String toString() {
sb.append("class DowntimeScheduleOneTimeCreateUpdateRequest {\n");
sb.append(" end: ").append(toIndentedString(end)).append("\n");
sb.append(" start: ").append(toIndentedString(start)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Loading