[Java] [Spring-client] Exclude discriminator from nullable annotation (#21981)

* Exclude the discriminator from getting a nullable-annotation

* Update samples
This commit is contained in:
Mattias Sehlstedt
2025-09-19 08:50:58 +02:00
committed by GitHub
parent ac3c37095d
commit 73c8728343
27 changed files with 39 additions and 24 deletions

View File

@@ -47,7 +47,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
public class Animal {
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;
public static final String JSON_PROPERTY_COLOR = "color";

View File

@@ -83,7 +83,7 @@ public class ParentWithNullable {
}
public static final String JSON_PROPERTY_TYPE = "type";
@jakarta.annotation.Nullable
// The discriminator does not have Nullability-annotation since it is added during serialization by the @JsonTypeName annotation
protected TypeEnum type;
public static final String JSON_PROPERTY_NULLABLE_PROPERTY = "nullableProperty";