Skip to content

Commit 676efae

Browse files
authored
[Java] Add import for java.util.Arrays if there is a set property in a model. Arrays.asList is used when initializing the property if it has a default value. (#22207)
1 parent a4d05b3 commit 676efae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert
18911891
model.imports.add("Arrays");
18921892
} else if ("set".equals(property.containerType)) {
18931893
model.imports.add("LinkedHashSet");
1894+
model.imports.add("Arrays");
18941895
if ((!openApiNullable || !property.isNullable) && jackson) { // cannot be wrapped to nullable
18951896
model.imports.add("JsonDeserialize");
18961897
property.vendorExtensions.put("x-setter-extra-annotation", "@JsonDeserialize(as = LinkedHashSet.class)");

0 commit comments

Comments
 (0)