@@ -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 */
@@ -736,7 +738,11 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
736738 .ctxAnnotations (null )
737739 .jsonUnwrappedHandler (null )
738740 .resolveAsRef (false );
739- handleUnwrapped (props , context .resolve (t ), uw .prefix (), uw .suffix (), requiredProps );
741+ Schema innerModel = context .resolve (t );
742+ if (StringUtils .isNotBlank (innerModel .get$ref ())) {
743+ innerModel = context .getDefinedModels ().get (innerModel .get$ref ().substring (SCHEMA_COMPONENT_PREFIX ));
744+ }
745+ handleUnwrapped (props , innerModel , uw .prefix (), uw .suffix (), requiredProps );
740746 return null ;
741747 } else {
742748 return new Schema ();
@@ -2291,7 +2297,7 @@ protected void resolveDiscriminatorProperty(JavaType type, ModelConverterContext
22912297 if (StringUtils .isNotBlank (typeInfoProp )) {
22922298 Schema modelToUpdate = model ;
22932299 if (StringUtils .isNotBlank (model .get$ref ())) {
2294- modelToUpdate = context .getDefinedModels ().get (model .get$ref ().substring (21 ));
2300+ modelToUpdate = context .getDefinedModels ().get (model .get$ref ().substring (SCHEMA_COMPONENT_PREFIX ));
22952301 }
22962302 if (modelToUpdate .getProperties () == null || !modelToUpdate .getProperties ().keySet ().contains (typeInfoProp )) {
22972303 Schema discriminatorSchema = new StringSchema ().name (typeInfoProp );
0 commit comments