@@ -118,6 +118,8 @@ public class ModelResolver extends AbstractModelConverter implements ModelConver
118
118
119
119
public static boolean composedModelPropertiesAsSibling = System .getProperty (SET_PROPERTY_OF_COMPOSED_MODEL_AS_SIBLING ) != null ;
120
120
121
+ private static final int SCHEMA_COMPONENT_PREFIX = "#/components/schemas/" .length ();
122
+
121
123
/**
122
124
* Allows all enums to be resolved as a reference to a scheme added to the components section.
123
125
*/
@@ -736,7 +738,11 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
736
738
.ctxAnnotations (null )
737
739
.jsonUnwrappedHandler (null )
738
740
.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 );
740
746
return null ;
741
747
} else {
742
748
return new Schema ();
@@ -2291,7 +2297,7 @@ protected void resolveDiscriminatorProperty(JavaType type, ModelConverterContext
2291
2297
if (StringUtils .isNotBlank (typeInfoProp )) {
2292
2298
Schema modelToUpdate = model ;
2293
2299
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 ));
2295
2301
}
2296
2302
if (modelToUpdate .getProperties () == null || !modelToUpdate .getProperties ().keySet ().contains (typeInfoProp )) {
2297
2303
Schema discriminatorSchema = new StringSchema ().name (typeInfoProp );
0 commit comments