mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-13 16:03:43 +00:00
Exclude the discriminator field from getting a nullable_var_annotations (#21155)
* Exclude the discriminator field from getting a nullable_var_annotations * Update samples * Manually add annotations since the remote pipeline insists that they should be there * Add description for why the discriminator does not have a nullability-annotation * Update samples
This commit is contained in:
parent
6c31cbbf47
commit
2513d82989
@ -67,7 +67,12 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
|||||||
{{#gson}}
|
{{#gson}}
|
||||||
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
@SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}})
|
||||||
{{/gson}}
|
{{/gson}}
|
||||||
|
{{^isDiscriminator}}
|
||||||
{{>nullable_var_annotations}}{{! prevent indent}}
|
{{>nullable_var_annotations}}{{! prevent indent}}
|
||||||
|
{{/isDiscriminator}}
|
||||||
|
{{#isDiscriminator}}
|
||||||
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
|
{{/isDiscriminator}}
|
||||||
{{#vendorExtensions.x-field-extra-annotation}}
|
{{#vendorExtensions.x-field-extra-annotation}}
|
||||||
{{{vendorExtensions.x-field-extra-annotation}}}
|
{{{vendorExtensions.x-field-extra-annotation}}}
|
||||||
{{/vendorExtensions.x-field-extra-annotation}}
|
{{/vendorExtensions.x-field-extra-annotation}}
|
||||||
|
@ -49,7 +49,7 @@ import java.util.StringJoiner;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -85,7 +85,7 @@ public class ParentWithNullable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_TYPE = "type";
|
public static final String JSON_PROPERTY_TYPE = "type";
|
||||||
@javax.annotation.Nullable
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected TypeEnum type;
|
protected TypeEnum type;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
||||||
|
@ -47,7 +47,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -50,7 +50,7 @@ import org.hibernate.validator.constraints.*;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
|
|||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
||||||
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String SERIALIZED_NAME_COLOR = "color";
|
public static final String SERIALIZED_NAME_COLOR = "color";
|
||||||
|
@ -46,7 +46,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -82,7 +82,7 @@ public class ParentWithNullable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_TYPE = "type";
|
public static final String JSON_PROPERTY_TYPE = "type";
|
||||||
@javax.annotation.Nullable
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected TypeEnum type;
|
protected TypeEnum type;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
||||||
|
@ -49,7 +49,7 @@ import jakarta.validation.Valid;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@jakarta.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
||||||
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String SERIALIZED_NAME_COLOR = "color";
|
public static final String SERIALIZED_NAME_COLOR = "color";
|
||||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
||||||
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String SERIALIZED_NAME_COLOR = "color";
|
public static final String SERIALIZED_NAME_COLOR = "color";
|
||||||
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
|
||||||
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
@SerializedName(SERIALIZED_NAME_CLASS_NAME)
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String SERIALIZED_NAME_COLOR = "color";
|
public static final String SERIALIZED_NAME_COLOR = "color";
|
||||||
|
@ -47,7 +47,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -46,7 +46,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -82,7 +82,7 @@ public class ParentWithNullable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_TYPE = "type";
|
public static final String JSON_PROPERTY_TYPE = "type";
|
||||||
@javax.annotation.Nullable
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected TypeEnum type;
|
protected TypeEnum type;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
||||||
|
@ -46,7 +46,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
|||||||
|
|
||||||
public class Animal {
|
public class Animal {
|
||||||
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
public static final String JSON_PROPERTY_CLASS_NAME = "className";
|
||||||
@javax.annotation.Nonnull
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected String className;
|
protected String className;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_COLOR = "color";
|
public static final String JSON_PROPERTY_COLOR = "color";
|
||||||
|
@ -82,7 +82,7 @@ public class ParentWithNullable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_TYPE = "type";
|
public static final String JSON_PROPERTY_TYPE = "type";
|
||||||
@javax.annotation.Nullable
|
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
|
||||||
protected TypeEnum type;
|
protected TypeEnum type;
|
||||||
|
|
||||||
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user