Skip to content

Commit

Permalink
#4781 Jackson/@JsonUnwrapped - when innerModel.$ref not null - unwrap…
Browse files Browse the repository at this point in the history
…ping does not happen
  • Loading branch information
mironbalcerzak committed Nov 15, 2024
1 parent e8bb595 commit e2ab9b8
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.ctxAnnotations(null)
.jsonUnwrappedHandler(null)
.resolveAsRef(false);
handleUnwrapped(props, context.resolve(t), uw.prefix(), uw.suffix(), requiredProps);
handleUnwrapped(context, props, context.resolve(t), uw.prefix(), uw.suffix(), requiredProps);
return null;
} else {
return new Schema();
Expand Down Expand Up @@ -1307,7 +1307,13 @@ protected boolean ignore(final Annotated member, final XmlAccessorType xmlAccess
return false;
}

private void handleUnwrapped(List<Schema> props, Schema innerModel, String prefix, String suffix, List<String> requiredProps) {
private void handleUnwrapped(ModelConverterContext context, List<Schema> props, Schema innerModel, String prefix, String suffix, List<String> requiredProps) {
if (innerModel.get$ref() != null && innerModel.getProperties() == null) {
Schema resolvedByRef = context.getDefinedModels().get(innerModel.get$ref().substring(21));
if (resolvedByRef != null) {
innerModel = resolvedByRef;
}
}
if (StringUtils.isBlank(suffix) && StringUtils.isBlank(prefix)) {
if (innerModel.getProperties() != null) {
props.addAll(innerModel.getProperties().values());
Expand Down

0 comments on commit e2ab9b8

Please sign in to comment.