DATAREST-665 - Prevent non-serializable properties from making it into the schema.
We now explicitly skip non-Jackson-serializable properties from being rendered in the schema. This prevents exceptions in rare cases where the Jackson BeanPropertyDefinition is only backed by a setter. The issue occurred with current Spring Data Gemfire as it considers a BigDecimal a PersistentEntity and then failed to produce a proper ResolvableProperty for setScale(…) as it's a setter-only property. Related tickets: SGF-429.
This commit is contained in:
@@ -166,8 +166,6 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
|
|||||||
|
|
||||||
JsonSchemaPropertyRegistrar registrar = new JsonSchemaPropertyRegistrar(jackson);
|
JsonSchemaPropertyRegistrar registrar = new JsonSchemaPropertyRegistrar(jackson);
|
||||||
|
|
||||||
// final List<JsonSchemaProperty<?>> properties = new ArrayList<JsonSchema.JsonSchemaProperty<?>>();
|
|
||||||
|
|
||||||
for (BeanPropertyDefinition definition : jackson) {
|
for (BeanPropertyDefinition definition : jackson) {
|
||||||
|
|
||||||
PersistentProperty<?> persistentProperty = entity.getPersistentProperty(definition.getInternalName());
|
PersistentProperty<?> persistentProperty = entity.getPersistentProperty(definition.getInternalName());
|
||||||
@@ -182,6 +180,10 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
|
|||||||
if (persistentProperty.isVersionProperty()) {
|
if (persistentProperty.isVersionProperty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!definition.couldSerialize()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeInformation<?> propertyType = persistentProperty == null
|
TypeInformation<?> propertyType = persistentProperty == null
|
||||||
|
|||||||
Reference in New Issue
Block a user