diff --git a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java index 761bc1b7f7..43649f541c 100644 --- a/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java +++ b/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java @@ -548,7 +548,7 @@ public static Optional getArraySchema(io.swagger.v3.oas.annotations.medi if (arraySchema.schema() != null) { if (arraySchema.schema().implementation().equals(Void.class)) { - getSchemaFromAnnotation(arraySchema.schema(), components, jsonViewAnnotation, openapi31).ifPresent(arraySchemaObject::setItems); + getSchemaFromAnnotation(arraySchema.schema(), components, jsonViewAnnotation, openapi31, arraySchemaObject.getItems()).ifPresent(arraySchemaObject::setItems); } else if (processSchemaImplementation) { getSchema(arraySchema.schema(), arraySchema, false, arraySchema.schema().implementation(), components, jsonViewAnnotation, openapi31).ifPresent(arraySchemaObject::setItems); } diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/ModelResolverOAS31Test.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/ModelResolverOAS31Test.java index 542cb87007..b6e78c81d2 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/ModelResolverOAS31Test.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/ModelResolverOAS31Test.java @@ -85,6 +85,15 @@ public void testOAS31Fields() { " properties:\n" + " billingAddress:\n" + " type: string\n" + + " acceptingCountries:\n" + + " type: array\n" + + " items:\n" + + " type: string\n" + + " description: accepting country\n" + + " enum:\n" + + " - UNITED_STATES_OF_AMERICA\n" + + " - CANADA\n" + + " uniqueItems: true\n" + "ModelWithOAS31Stuff:\n" + " type: object\n" + " $comment: Random comment at schema level\n" + diff --git a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CreditCard.java b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CreditCard.java index fc8d4c900c..e621c5525d 100644 --- a/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CreditCard.java +++ b/modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/v31/model/CreditCard.java @@ -1,9 +1,16 @@ package io.swagger.v3.core.resolving.v31.model; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.Set; + public class CreditCard { private String billingAddress; + private Set acceptingCountries; + public String getBillingAddress() { return billingAddress; } @@ -11,4 +18,13 @@ public String getBillingAddress() { public void setBillingAddress(String billingAddress) { this.billingAddress = billingAddress; } + + @ArraySchema(schema = @Schema(description = "accepting country")) + public Set getAcceptingCountries() { + return acceptingCountries; + } + + public void setAcceptingCountries(Set acceptingCountries) { + this.acceptingCountries = acceptingCountries; + } }