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:
Oliver Gierke
2015-09-08 15:14:28 +02:00
parent 468c7b4d12
commit 2a835c48fa

View File

@@ -166,8 +166,6 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
JsonSchemaPropertyRegistrar registrar = new JsonSchemaPropertyRegistrar(jackson);
// final List<JsonSchemaProperty<?>> properties = new ArrayList<JsonSchema.JsonSchemaProperty<?>>();
for (BeanPropertyDefinition definition : jackson) {
PersistentProperty<?> persistentProperty = entity.getPersistentProperty(definition.getInternalName());
@@ -182,6 +180,10 @@ public class PersistentEntityToJsonSchemaConverter implements ConditionalGeneric
if (persistentProperty.isVersionProperty()) {
continue;
}
if (!definition.couldSerialize()) {
continue;
}
}
TypeInformation<?> propertyType = persistentProperty == null