@@ -489,10 +489,16 @@ public static Optional<ArraySchema> getArraySchema(io.swagger.v3.oas.annotations
489489 }
490490 return Optional .empty ();
491491 }
492+
492493 public static Optional <Schema > getArraySchema (io .swagger .v3 .oas .annotations .media .ArraySchema arraySchema , Components components , JsonView jsonViewAnnotation , boolean openapi31 , Schema existingSchema ) {
493494 return getArraySchema (arraySchema , components , jsonViewAnnotation , openapi31 , existingSchema , false );
494495 }
496+
495497 public static Optional <Schema > getArraySchema (io .swagger .v3 .oas .annotations .media .ArraySchema arraySchema , Components components , JsonView jsonViewAnnotation , boolean openapi31 , Schema existingSchema , boolean processSchemaImplementation ) {
498+ return getArraySchema (arraySchema , components , jsonViewAnnotation , openapi31 , existingSchema , processSchemaImplementation , null );
499+ }
500+
501+ public static Optional <Schema > getArraySchema (io .swagger .v3 .oas .annotations .media .ArraySchema arraySchema , Components components , JsonView jsonViewAnnotation , boolean openapi31 , Schema existingSchema , boolean processSchemaImplementation , ModelConverterContext context ) {
496502 if (arraySchema == null || !hasArrayAnnotation (arraySchema )) {
497503 if (existingSchema == null ) {
498504 return Optional .empty ();
@@ -525,8 +531,8 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
525531 arraySchemaObject .setMinItems (arraySchema .minItems ());
526532 }
527533
528- getSchemaFromAnnotation (arraySchema .contains (), components , jsonViewAnnotation , openapi31 ).ifPresent (arraySchemaObject ::setContains );
529- getSchemaFromAnnotation (arraySchema .unevaluatedItems (), components , jsonViewAnnotation , openapi31 ).ifPresent (arraySchemaObject ::setUnevaluatedItems );
534+ getSchemaFromAnnotation (arraySchema .contains (), components , jsonViewAnnotation , openapi31 , null , context ).ifPresent (arraySchemaObject ::setContains );
535+ getSchemaFromAnnotation (arraySchema .unevaluatedItems (), components , jsonViewAnnotation , openapi31 , null , context ).ifPresent (arraySchemaObject ::setUnevaluatedItems );
530536
531537 if (arraySchema .maxContains () > 0 ) {
532538 arraySchemaObject .setMaxContains (arraySchema .maxContains ());
@@ -536,7 +542,7 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
536542 }
537543 if (arraySchema .prefixItems ().length > 0 ) {
538544 for (io .swagger .v3 .oas .annotations .media .Schema prefixItem : arraySchema .prefixItems ()) {
539- getSchemaFromAnnotation (prefixItem , components , jsonViewAnnotation , openapi31 ).ifPresent (arraySchemaObject ::addPrefixItem );
545+ getSchemaFromAnnotation (prefixItem , components , jsonViewAnnotation , openapi31 , null , context ).ifPresent (arraySchemaObject ::addPrefixItem );
540546 }
541547 }
542548
@@ -550,10 +556,10 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
550556
551557 if (arraySchema .schema () != null ) {
552558 if (arraySchema .schema ().implementation ().equals (Void .class )) {
553- getSchemaFromAnnotation (arraySchema .schema (), components , jsonViewAnnotation , openapi31 , arraySchemaObject .getItems ())
559+ getSchemaFromAnnotation (arraySchema .schema (), components , jsonViewAnnotation , openapi31 , arraySchemaObject .getItems (), context )
554560 .ifPresent (arraySchemaObject ::setItems );
555561 } else if (processSchemaImplementation ) {
556- getSchema (arraySchema .schema (), arraySchema , false , arraySchema .schema ().implementation (), components , jsonViewAnnotation , openapi31 )
562+ getSchema (arraySchema .schema (), arraySchema , false , arraySchema .schema ().implementation (), components , jsonViewAnnotation , openapi31 , context )
557563 .ifPresent (arraySchemaObject ::setItems );
558564 }
559565 }
@@ -1848,21 +1854,31 @@ public static Optional<? extends Schema> getSchema(io.swagger.v3.oas.annotations
18481854 return getSchema (schemaAnnotation , arrayAnnotation , isArray , schemaImplementation , components , jsonViewAnnotation , false );
18491855
18501856 }
1851-
18521857 public static Optional <? extends Schema > getSchema (io .swagger .v3 .oas .annotations .media .Schema schemaAnnotation ,
18531858 io .swagger .v3 .oas .annotations .media .ArraySchema arrayAnnotation ,
18541859 boolean isArray ,
18551860 Class <?> schemaImplementation ,
18561861 Components components ,
18571862 JsonView jsonViewAnnotation ,
18581863 boolean openapi31 ) {
1864+ return getSchema (schemaAnnotation , arrayAnnotation , isArray , schemaImplementation , components , jsonViewAnnotation , openapi31 , null );
1865+ }
1866+
1867+ public static Optional <? extends Schema > getSchema (io .swagger .v3 .oas .annotations .media .Schema schemaAnnotation ,
1868+ io .swagger .v3 .oas .annotations .media .ArraySchema arrayAnnotation ,
1869+ boolean isArray ,
1870+ Class <?> schemaImplementation ,
1871+ Components components ,
1872+ JsonView jsonViewAnnotation ,
1873+ boolean openapi31 ,
1874+ ModelConverterContext context ) {
18591875 if (schemaImplementation != Void .class ) {
1860- Schema schemaObject = resolveSchemaFromType (schemaImplementation , components , jsonViewAnnotation , openapi31 , schemaAnnotation , arrayAnnotation , null );
1876+ Schema schemaObject = resolveSchemaFromType (schemaImplementation , components , jsonViewAnnotation , openapi31 , schemaAnnotation , arrayAnnotation , context );
18611877 if (StringUtils .isNotBlank (schemaAnnotation .format ())) {
18621878 schemaObject .setFormat (schemaAnnotation .format ());
18631879 }
18641880 if (isArray ) {
1865- Optional <Schema > arraySchema = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null );
1881+ Optional <Schema > arraySchema = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null , false , context );
18661882 if (arraySchema .isPresent ()) {
18671883 arraySchema .get ().setItems (schemaObject );
18681884 return arraySchema ;
@@ -1874,15 +1890,15 @@ public static Optional<? extends Schema> getSchema(io.swagger.v3.oas.annotations
18741890 }
18751891
18761892 } else {
1877- Optional <Schema > schemaFromAnnotation = AnnotationsUtils .getSchemaFromAnnotation (schemaAnnotation , components , jsonViewAnnotation , openapi31 );
1893+ Optional <Schema > schemaFromAnnotation = AnnotationsUtils .getSchemaFromAnnotation (schemaAnnotation , components , jsonViewAnnotation , openapi31 , null , context );
18781894 if (schemaFromAnnotation .isPresent ()) {
18791895 if (StringUtils .isBlank (schemaFromAnnotation .get ().get$ref ()) && StringUtils .isBlank (schemaFromAnnotation .get ().getType ()) && !(schemaFromAnnotation .get () instanceof ComposedSchema )) {
18801896 // default to string
18811897 schemaFromAnnotation .get ().setType ("string" );
18821898 }
18831899 return Optional .of (schemaFromAnnotation .get ());
18841900 } else {
1885- Optional <Schema > arraySchemaFromAnnotation = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null );
1901+ Optional <Schema > arraySchemaFromAnnotation = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null , false , context );
18861902 if (arraySchemaFromAnnotation .isPresent ()) {
18871903 if (arraySchemaFromAnnotation .get ().getItems () != null && StringUtils .isBlank (arraySchemaFromAnnotation .get ().getItems ().get$ref ()) && StringUtils .isBlank (arraySchemaFromAnnotation .get ().getItems ().getType ())) {
18881904 // default to string
0 commit comments