Skip to content

Commit a7b78bf

Browse files
committed
moved changes to updated file and the removed miss located one
1 parent e646f7f commit a7b78bf

File tree

2 files changed

+8
-245
lines changed

2 files changed

+8
-245
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/ModelUtils.java

Lines changed: 0 additions & 243 deletions
This file was deleted.

modules/swagger-codegen/src/main/java/io/swagger/codegen/v3/utils/ModelUtils.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import java.util.HashMap;
1313
import java.util.List;
1414
import java.util.Map;
15+
import java.util.Objects;
16+
import java.util.stream.Collectors;
17+
import java.util.stream.Stream;
1518

1619
public class ModelUtils {
1720
/**
@@ -43,15 +46,18 @@ public static CodegenModel getModelByName(final String name, final Map<String, O
4346
}
4447

4548
public static Operation[] createOperationArray (PathItem pathItem) {
46-
return new Operation[]{
49+
return Stream.of(
4750
pathItem.getGet(),
4851
pathItem.getPost(),
4952
pathItem.getDelete(),
5053
pathItem.getHead(),
5154
pathItem.getPut(),
5255
pathItem.getPatch(),
5356
pathItem.getOptions()
54-
};
57+
)
58+
.filter(Objects::nonNull)
59+
.collect(Collectors.toSet())
60+
.toArray(new Operation[]{});
5561
}
5662

5763
public static void processCodegenModels(Map<String, CodegenModel> allModels) {

0 commit comments

Comments
 (0)