33
33
import io .swagger .v3 .core .util .AnnotationsUtils ;
34
34
import io .swagger .v3 .core .util .Constants ;
35
35
import io .swagger .v3 .core .util .Json ;
36
- import io .swagger .v3 .core .util .Json31 ;
37
36
import io .swagger .v3 .core .util .ObjectMapperFactory ;
38
- import io .swagger .v3 .core .util .OpenAPISchema2JsonSchema ;
39
37
import io .swagger .v3 .core .util .OptionalUtils ;
40
38
import io .swagger .v3 .core .util .PrimitiveType ;
41
39
import io .swagger .v3 .core .util .ReflectionUtils ;
@@ -115,11 +113,6 @@ public class ModelResolver extends AbstractModelConverter implements ModelConver
115
113
*/
116
114
public static boolean enumsAsRef = System .getProperty (SET_PROPERTY_OF_ENUMS_AS_REF ) != null ;
117
115
118
- /**
119
- * @since 2.1.8
120
- */
121
- protected OpenAPISchema2JsonSchema jsonSchemaProcessor = new OpenAPISchema2JsonSchema ();
122
-
123
116
public ModelResolver (ObjectMapper mapper ) {
124
117
super (mapper );
125
118
}
@@ -204,15 +197,11 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
204
197
if (resolvedSchemaAnnotation != null &&
205
198
StringUtils .isNotEmpty (resolvedSchemaAnnotation .ref ())) {
206
199
if (resolvedArrayAnnotation == null ) {
207
- Schema result = new Schema ().$ref (resolvedSchemaAnnotation .ref ()).name (name );
208
- jsonSchemaProcessor .process (result );
209
200
return new Schema ().$ref (resolvedSchemaAnnotation .ref ()).name (name );
210
201
} else {
211
202
ArraySchema schema = new ArraySchema ();
212
203
resolveArraySchema (annotatedType , schema , resolvedArrayAnnotation );
213
- schema .items (new Schema ().$ref (resolvedSchemaAnnotation .ref ()).name (name ));
214
- jsonSchemaProcessor .process (schema );
215
- return schema ;
204
+ return schema .items (new Schema ().$ref (resolvedSchemaAnnotation .ref ()).name (name ));
216
205
}
217
206
}
218
207
@@ -264,7 +253,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
264
253
}
265
254
}
266
255
schema .setItems (innerSchema );
267
- jsonSchemaProcessor .process (schema );
268
256
return schema ;
269
257
} else {
270
258
Schema implSchema = context .resolve (aType );
@@ -276,9 +264,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
276
264
} else if (implSchema != null && implSchema .get$ref () != null ) {
277
265
implSchema = new Schema ().$ref (StringUtils .isNotEmpty (implSchema .get$ref ()) ? implSchema .get$ref () : implSchema .getName ());
278
266
}
279
- if (implSchema != null ) {
280
- jsonSchemaProcessor .process (implSchema );
281
- }
282
267
return implSchema ;
283
268
}
284
269
}
@@ -326,7 +311,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
326
311
}
327
312
model = new GeneratorWrapper ().processJsonIdentity (annotatedType , context , _mapper , jsonIdentityInfo , jsonIdentityReference );
328
313
if (model != null ) {
329
- jsonSchemaProcessor .process (model );
330
314
return model ;
331
315
}
332
316
}
@@ -357,19 +341,14 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
357
341
ArraySchema schema = new ArraySchema ();
358
342
resolveArraySchema (annotatedType , schema , resolvedArrayAnnotation );
359
343
schema .setItems (model );
360
- jsonSchemaProcessor .process (schema );
361
344
return schema ;
362
345
}
363
346
if (type .isEnumType () && shouldResolveEnumAsRef (resolvedSchemaAnnotation )) {
364
347
// Store off the ref and add the enum as a top-level model
365
- jsonSchemaProcessor .process (model );
366
348
context .defineModel (name , model , annotatedType , null );
367
349
// Return the model as a ref only property
368
350
model = new Schema ().$ref (Components .COMPONENTS_SCHEMAS_REF + name );
369
351
}
370
- if (model != null ) {
371
- jsonSchemaProcessor .process (model );
372
- }
373
352
return model ;
374
353
}
375
354
@@ -388,7 +367,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
388
367
Schema resolvedModel = context .resolve (annotatedType );
389
368
if (resolvedModel != null ) {
390
369
if (name != null && name .equals (resolvedModel .getName ())) {
391
- jsonSchemaProcessor .process (resolvedModel );
392
370
return resolvedModel ;
393
371
}
394
372
}
@@ -406,11 +384,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
406
384
.propertyName (annotatedType .getPropertyName ())
407
385
.ctxAnnotations (annotatedType .getCtxAnnotations ())
408
386
.skipOverride (true );
409
- Schema result = context .resolve (aType );
410
- if (result != null ) {
411
- jsonSchemaProcessor .process (result );
412
- }
413
- return result ;
387
+ return context .resolve (aType );
414
388
}
415
389
416
390
List <Class <?>> composedSchemaReferencedClasses = getComposedSchemaReferencedClasses (type .getRawClass (), annotatedType .getCtxAnnotations (), resolvedSchemaAnnotation );
@@ -526,9 +500,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
526
500
AnnotatedType aType = OptionalUtils .unwrapOptional (annotatedType );
527
501
if (aType != null ) {
528
502
model = context .resolve (aType );
529
- if (model != null ) {
530
- jsonSchemaProcessor .process (model );
531
- }
532
503
return model ;
533
504
} else {
534
505
model = new Schema ()
@@ -539,7 +510,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
539
510
540
511
if (!type .isContainerType () && StringUtils .isNotBlank (name )) {
541
512
// define the model here to support self/cyclic referencing of models
542
- jsonSchemaProcessor .process (model );
543
513
context .defineModel (name , model , annotatedType , null );
544
514
}
545
515
@@ -766,7 +736,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
766
736
* available for modification by resolveSubtypes, when their parents are created.
767
737
*/
768
738
if (!type .isContainerType () && StringUtils .isNotBlank (name )) {
769
- jsonSchemaProcessor .process (model );
770
739
context .defineModel (name , model , annotatedType , null );
771
740
}
772
741
@@ -897,7 +866,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
897
866
898
867
if (!type .isContainerType () && StringUtils .isNotBlank (name )) {
899
868
// define the model here to support self/cyclic referencing of models
900
- jsonSchemaProcessor .process (model );
901
869
context .defineModel (name , model , annotatedType , null );
902
870
}
903
871
@@ -917,7 +885,6 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
917
885
ArraySchema schema = new ArraySchema ();
918
886
schema .setItems (model );
919
887
resolveArraySchema (annotatedType , schema , resolvedArrayAnnotation );
920
- jsonSchemaProcessor .process (schema );
921
888
return schema ;
922
889
} else {
923
890
if (model instanceof ArraySchema ) {
@@ -1421,8 +1388,6 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert
1421
1388
composedSchema = (ComposedSchema ) new ComposedSchema ()
1422
1389
.title (subtypeModel .getTitle ())
1423
1390
.name (subtypeModel .getName ())
1424
- .id (subtypeModel .get$id ())
1425
- .schema (subtypeModel .get$schema ())
1426
1391
.deprecated (subtypeModel .getDeprecated ())
1427
1392
.additionalProperties (subtypeModel .getAdditionalProperties ())
1428
1393
.description (subtypeModel .getDescription ())
@@ -1478,7 +1443,6 @@ private boolean resolveSubtypes(Schema model, BeanDescription bean, ModelConvert
1478
1443
// replace previous schema..
1479
1444
Class <?> currentType = subtype .getType ();
1480
1445
if (StringUtils .isNotBlank (composedSchema .getName ())) {
1481
- jsonSchemaProcessor .process (composedSchema );
1482
1446
context .defineModel (composedSchema .getName (), composedSchema , new AnnotatedType ().type (currentType ), null );
1483
1447
}
1484
1448
@@ -1576,19 +1540,6 @@ protected String resolveFormat(Annotated a, Annotation[] annotations, io.swagger
1576
1540
return null ;
1577
1541
}
1578
1542
1579
- protected String resolveId (Annotated a , Annotation [] annotations , io .swagger .v3 .oas .annotations .media .Schema schema ) {
1580
- if (schema != null && StringUtils .isNotBlank (schema .id ())) {
1581
- return schema .id ();
1582
- }
1583
- return null ;
1584
- }
1585
- protected String resolveSchema (Annotated a , Annotation [] annotations , io .swagger .v3 .oas .annotations .media .Schema schema ) {
1586
- if (schema != null && StringUtils .isNotBlank (schema .schema ())) {
1587
- return schema .schema ();
1588
- }
1589
- return null ;
1590
- }
1591
-
1592
1543
protected Map <String , Schema > resolvePatternProperties (JavaType a , Annotation [] annotations , ModelConverterContext context ) {
1593
1544
1594
1545
final Map <String , PatternProperty > propList = new LinkedHashMap <>();
@@ -2168,14 +2119,6 @@ protected void resolveSchemaMembers(Schema schema, Annotated a, Annotation[] ann
2168
2119
if (StringUtils .isNotBlank (title )) {
2169
2120
schema .title (title );
2170
2121
}
2171
- String id = resolveId (a , annotations , schemaAnnotation );
2172
- if (StringUtils .isNotBlank (id )) {
2173
- schema .id (id );
2174
- }
2175
- String schemaUrl = resolveSchema (a , annotations , schemaAnnotation );
2176
- if (StringUtils .isNotBlank (schemaUrl )) {
2177
- schema .schema (schemaUrl );
2178
- }
2179
2122
String format = resolveFormat (a , annotations , schemaAnnotation );
2180
2123
if (StringUtils .isNotBlank (format ) && StringUtils .isBlank (schema .getFormat ())) {
2181
2124
schema .format (format );
0 commit comments