@@ -493,6 +493,10 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
493493 }
494494
495495 public static Optional <Schema > getArraySchema (io .swagger .v3 .oas .annotations .media .ArraySchema arraySchema , Components components , JsonView jsonViewAnnotation , boolean openapi31 , Schema existingSchema , boolean processSchemaImplementation ) {
496+ return getArraySchema (arraySchema , components , jsonViewAnnotation , openapi31 , existingSchema , processSchemaImplementation , null );
497+ }
498+
499+ 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 ) {
496500 if (arraySchema == null || !hasArrayAnnotation (arraySchema )) {
497501 if (existingSchema == null ) {
498502 return Optional .empty ();
@@ -525,8 +529,8 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
525529 arraySchemaObject .setMinItems (arraySchema .minItems ());
526530 }
527531
528- getSchemaFromAnnotation (arraySchema .contains (), components , jsonViewAnnotation , openapi31 ).ifPresent (arraySchemaObject ::setContains );
529- getSchemaFromAnnotation (arraySchema .unevaluatedItems (), components , jsonViewAnnotation , openapi31 ).ifPresent (arraySchemaObject ::setUnevaluatedItems );
532+ getSchemaFromAnnotation (arraySchema .contains (), components , jsonViewAnnotation , openapi31 , null , context ).ifPresent (arraySchemaObject ::setContains );
533+ getSchemaFromAnnotation (arraySchema .unevaluatedItems (), components , jsonViewAnnotation , openapi31 , null , context ).ifPresent (arraySchemaObject ::setUnevaluatedItems );
530534
531535 if (arraySchema .maxContains () > 0 ) {
532536 arraySchemaObject .setMaxContains (arraySchema .maxContains ());
@@ -536,7 +540,7 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
536540 }
537541 if (arraySchema .prefixItems ().length > 0 ) {
538542 for (io .swagger .v3 .oas .annotations .media .Schema prefixItem : arraySchema .prefixItems ()) {
539- getSchemaFromAnnotation (prefixItem , components , jsonViewAnnotation , openapi31 ).ifPresent (arraySchemaObject ::addPrefixItem );
543+ getSchemaFromAnnotation (prefixItem , components , jsonViewAnnotation , openapi31 , null , context ).ifPresent (arraySchemaObject ::addPrefixItem );
540544 }
541545 }
542546
@@ -550,10 +554,10 @@ public static Optional<Schema> getArraySchema(io.swagger.v3.oas.annotations.medi
550554
551555 if (arraySchema .schema () != null ) {
552556 if (arraySchema .schema ().implementation ().equals (Void .class )) {
553- getSchemaFromAnnotation (arraySchema .schema (), components , jsonViewAnnotation , openapi31 , arraySchemaObject .getItems ())
557+ getSchemaFromAnnotation (arraySchema .schema (), components , jsonViewAnnotation , openapi31 , arraySchemaObject .getItems (), context )
554558 .ifPresent (arraySchemaObject ::setItems );
555559 } else if (processSchemaImplementation ) {
556- getSchema (arraySchema .schema (), arraySchema , false , arraySchema .schema ().implementation (), components , jsonViewAnnotation , openapi31 )
560+ getSchema (arraySchema .schema (), arraySchema , false , arraySchema .schema ().implementation (), components , jsonViewAnnotation , openapi31 , context )
557561 .ifPresent (arraySchemaObject ::setItems );
558562 }
559563 }
@@ -622,7 +626,7 @@ public static Optional<Schema> getSchemaFromAnnotation(
622626 boolean openapi31 ,
623627 Schema existingSchema ,
624628 ModelConverterContext context ) {
625- return getSchemaFromAnnotation (schema , components , jsonViewAnnotation , openapi31 , existingSchema , Schema .SchemaResolution .DEFAULT , null );
629+ return getSchemaFromAnnotation (schema , components , jsonViewAnnotation , openapi31 , existingSchema , Schema .SchemaResolution .DEFAULT , context );
626630 }
627631
628632 public static Optional <Schema > getSchemaFromAnnotation (
@@ -1888,21 +1892,31 @@ public static Optional<? extends Schema> getSchema(io.swagger.v3.oas.annotations
18881892 return getSchema (schemaAnnotation , arrayAnnotation , isArray , schemaImplementation , components , jsonViewAnnotation , false );
18891893
18901894 }
1891-
18921895 public static Optional <? extends Schema > getSchema (io .swagger .v3 .oas .annotations .media .Schema schemaAnnotation ,
18931896 io .swagger .v3 .oas .annotations .media .ArraySchema arrayAnnotation ,
18941897 boolean isArray ,
18951898 Class <?> schemaImplementation ,
18961899 Components components ,
18971900 JsonView jsonViewAnnotation ,
18981901 boolean openapi31 ) {
1902+ return getSchema (schemaAnnotation , arrayAnnotation , isArray , schemaImplementation , components , jsonViewAnnotation , openapi31 , null );
1903+ }
1904+
1905+ public static Optional <? extends Schema > getSchema (io .swagger .v3 .oas .annotations .media .Schema schemaAnnotation ,
1906+ io .swagger .v3 .oas .annotations .media .ArraySchema arrayAnnotation ,
1907+ boolean isArray ,
1908+ Class <?> schemaImplementation ,
1909+ Components components ,
1910+ JsonView jsonViewAnnotation ,
1911+ boolean openapi31 ,
1912+ ModelConverterContext context ) {
18991913 if (schemaImplementation != Void .class ) {
1900- Schema schemaObject = resolveSchemaFromType (schemaImplementation , components , jsonViewAnnotation , openapi31 , schemaAnnotation , arrayAnnotation , null );
1914+ Schema schemaObject = resolveSchemaFromType (schemaImplementation , components , jsonViewAnnotation , openapi31 , schemaAnnotation , arrayAnnotation , context );
19011915 if (StringUtils .isNotBlank (schemaAnnotation .format ())) {
19021916 schemaObject .setFormat (schemaAnnotation .format ());
19031917 }
19041918 if (isArray ) {
1905- Optional <Schema > arraySchema = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null );
1919+ Optional <Schema > arraySchema = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null , false , context );
19061920 if (arraySchema .isPresent ()) {
19071921 arraySchema .get ().setItems (schemaObject );
19081922 return arraySchema ;
@@ -1914,15 +1928,15 @@ public static Optional<? extends Schema> getSchema(io.swagger.v3.oas.annotations
19141928 }
19151929
19161930 } else {
1917- Optional <Schema > schemaFromAnnotation = AnnotationsUtils .getSchemaFromAnnotation (schemaAnnotation , components , jsonViewAnnotation , openapi31 );
1931+ Optional <Schema > schemaFromAnnotation = AnnotationsUtils .getSchemaFromAnnotation (schemaAnnotation , components , jsonViewAnnotation , openapi31 , null , context );
19181932 if (schemaFromAnnotation .isPresent ()) {
19191933 if (StringUtils .isBlank (schemaFromAnnotation .get ().get$ref ()) && StringUtils .isBlank (schemaFromAnnotation .get ().getType ()) && !(schemaFromAnnotation .get () instanceof ComposedSchema )) {
19201934 // default to string
19211935 schemaFromAnnotation .get ().setType ("string" );
19221936 }
19231937 return Optional .of (schemaFromAnnotation .get ());
19241938 } else {
1925- Optional <Schema > arraySchemaFromAnnotation = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null );
1939+ Optional <Schema > arraySchemaFromAnnotation = AnnotationsUtils .getArraySchema (arrayAnnotation , components , jsonViewAnnotation , openapi31 , null , false , context );
19261940 if (arraySchemaFromAnnotation .isPresent ()) {
19271941 if (arraySchemaFromAnnotation .get ().getItems () != null && StringUtils .isBlank (arraySchemaFromAnnotation .get ().getItems ().get$ref ()) && StringUtils .isBlank (arraySchemaFromAnnotation .get ().getItems ().getType ())) {
19281942 // default to string
0 commit comments