Skip to content
Merged
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 @@ -971,11 +971,12 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context

/**
* This must be done after model.setProperties so that the model's set
* of properties is available to filter from any subtypes
* of properties is available to filter from any subtypes.
*
* No discriminator reset is needed here: the model has no discriminator yet at this point,
* it is set exclusively by resolveDiscriminator below.
**/
if (!resolveSubtypes(model, beanDesc, context, annotatedType.getJsonViewAnnotation())) {
model.setDiscriminator(null);
}
resolveSubtypes(model, beanDesc, context, annotatedType.getJsonViewAnnotation());

Discriminator discriminator = resolveDiscriminator(type, context);
if (discriminator != null) {
Expand Down Expand Up @@ -2035,10 +2036,10 @@ protected boolean applyBeanValidatorAnnotationsNoGroups(Schema property, Annotat
return modified;
}

private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConverterContext context, JsonView jsonViewAnnotation) {
private void resolveSubtypes(Schema model, BeanDescription bean, ModelConverterContext context, JsonView jsonViewAnnotation) {
final List<NamedType> types = _intr().findSubtypes(bean.getClassInfo());
if (types == null) {
return false;
return;
}

/**
Expand All @@ -2055,7 +2056,6 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert
*/
removeSuperClassAndInterfaceSubTypes(types, bean);

int count = 0;
final Class<?> beanClass = bean.getClassInfo().getAnnotated();
for (NamedType subtype : types) {
final Class<?> subtypeType = subtype.getType();
Expand Down Expand Up @@ -2109,7 +2109,6 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert
}

}
return count != 0;
}

private void removeSelfFromSubTypes(List<NamedType> types, BeanDescription bean) {
Expand Down
Loading