Skip to content

Commit

Permalink
Merge branch 'main' into iss_5608
Browse files Browse the repository at this point in the history
  • Loading branch information
qingboooo authored Nov 28, 2023
2 parents 84b5269 + 98611d7 commit 861817d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;

import static io.fabric8.java.generator.nodes.Keywords.JAVA_LANG_LONG;
Expand All @@ -39,7 +41,7 @@ public class JEnum extends AbstractJSONSchema2Pojo {

private final String type;
private final String underlyingType;
private final List<String> values;
private final Set<String> values; //Let's prevent duplicates

public JEnum(String type, String underlyingType, List<JsonNode> values, Config config, String description,
final boolean isNullable,
Expand All @@ -48,7 +50,8 @@ public JEnum(String type, String underlyingType, List<JsonNode> values, Config c
this.type = AbstractJSONSchema2Pojo.sanitizeString(
type.substring(0, 1).toUpperCase() + type.substring(1));
this.underlyingType = underlyingType;
this.values = values.stream().map(JsonNode::asText).collect(Collectors.toList());
//Tests assume order so let's use LinkedHashSet instead of just using Collectors.toSet()
this.values = values.stream().map(JsonNode::asText).collect(Collectors.toCollection(LinkedHashSet::new));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<buildnumber.plugin.version>3.2.0</buildnumber.plugin.version>
<maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
<maven.bundle.plugin.version>5.1.9</maven.bundle.plugin.version>
<maven.buildhelper.plugin.version>3.4.0</maven.buildhelper.plugin.version>
<maven.buildhelper.plugin.version>3.5.0</maven.buildhelper.plugin.version>
<maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
<maven.surefire.plugin.version>3.2.2</maven.surefire.plugin.version>
<maven.scr.plugin.version>1.26.4</maven.scr.plugin.version>
Expand All @@ -164,7 +164,7 @@
<jkube.version>1.14.0</jkube.version>
<sonar-maven-plugin.version>3.10.0.2594</sonar-maven-plugin.version>
<nexus-staging-maven-plugin>1.6.13</nexus-staging-maven-plugin>
<spotless-maven-plugin.version>2.40.0</spotless-maven-plugin.version>
<spotless-maven-plugin.version>2.41.0</spotless-maven-plugin.version>

<!-- Other options -->
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down

0 comments on commit 861817d

Please sign in to comment.