@@ -118,6 +118,8 @@ public class ModelResolver extends AbstractModelConverter implements ModelConver
118118
119119 public static boolean composedModelPropertiesAsSibling = System .getProperty (SET_PROPERTY_OF_COMPOSED_MODEL_AS_SIBLING ) != null ;
120120
121+ private static final int SCHEMA_COMPONENT_PREFIX = "#/components/schemas/" .length ();
122+
121123 /**
122124 * Allows all enums to be resolved as a reference to a scheme added to the components section.
123125 */
@@ -727,7 +729,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
727729 .ctxAnnotations (null )
728730 .jsonUnwrappedHandler (null )
729731 .resolveAsRef (false );
730- handleUnwrapped (props , context .resolve (t ), uw .prefix (), uw .suffix (), requiredProps );
732+ handleUnwrapped (context , props , context .resolve (t ), uw .prefix (), uw .suffix (), requiredProps );
731733 return null ;
732734 } else {
733735 return new Schema ();
@@ -1307,7 +1309,10 @@ protected boolean ignore(final Annotated member, final XmlAccessorType xmlAccess
13071309 return false ;
13081310 }
13091311
1310- private void handleUnwrapped (List <Schema > props , Schema innerModel , String prefix , String suffix , List <String > requiredProps ) {
1312+ private void handleUnwrapped (ModelConverterContext context , List <Schema > props , Schema innerModel , String prefix , String suffix , List <String > requiredProps ) {
1313+ if (StringUtils .isNotBlank (innerModel .get$ref ())) {
1314+ innerModel = context .getDefinedModels ().get (innerModel .get$ref ().substring (SCHEMA_COMPONENT_PREFIX ));
1315+ }
13111316 if (StringUtils .isBlank (suffix ) && StringUtils .isBlank (prefix )) {
13121317 if (innerModel .getProperties () != null ) {
13131318 props .addAll (innerModel .getProperties ().values ());
@@ -2278,7 +2283,7 @@ protected void resolveDiscriminatorProperty(JavaType type, ModelConverterContext
22782283 if (StringUtils .isNotBlank (typeInfoProp )) {
22792284 Schema modelToUpdate = model ;
22802285 if (StringUtils .isNotBlank (model .get$ref ())) {
2281- modelToUpdate = context .getDefinedModels ().get (model .get$ref ().substring (21 ));
2286+ modelToUpdate = context .getDefinedModels ().get (model .get$ref ().substring (SCHEMA_COMPONENT_PREFIX ));
22822287 }
22832288 if (modelToUpdate .getProperties () == null || !modelToUpdate .getProperties ().keySet ().contains (typeInfoProp )) {
22842289 Schema discriminatorSchema = new StringSchema ().name (typeInfoProp );
0 commit comments