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
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@ public abstract class AbstractOpenApiSchema {
* @return true if it's nullable
*/
public Boolean isNullable() {
if (Boolean.TRUE.equals(isNullable)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
return Boolean.TRUE.equals(isNullable);
}

{{>libraries/jersey2/additional_properties}}
Expand Down
12 changes: 6 additions & 6 deletions templates-v7/libraries/jersey3/JSON.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import jakarta.ws.rs.ext.ContextResolver;
public class JSON implements ContextResolver<ObjectMapper> {
private static ObjectMapper mapper;

public JSON() {
private JSON() {
mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false);
mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Expand Down Expand Up @@ -83,7 +83,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
if (cdm != null) {
return cdm.getClassForElement(node, new HashSet<Class<?>>());
return cdm.getClassForElement(node, new HashSet<>());
}
return null;
}
Expand All @@ -103,7 +103,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
modelClass = cls;
discriminatorName = propertyName;
discriminatorMappings = new HashMap<String, Class<?>>();
discriminatorMappings = new HashMap<>();
if (mappings != null) {
discriminatorMappings.putAll(mappings);
}
Expand Down Expand Up @@ -212,12 +212,12 @@ public class JSON implements ContextResolver<ObjectMapper> {
/**
* A map of discriminators for all model classes.
*/
private static Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<Class<?>, ClassDiscriminatorMapping>();
private static final Map<Class<?>, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<Class<?>, ClassDiscriminatorMapping>();

/**
* A map of oneOf/anyOf descendants for each model class.
*/
private static Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<Class<?>, Map<String, GenericType>>();
private static final Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();

/**
* Register a model class discriminator.
Expand Down