You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/10/31 09:16:01 UTC
[camel] 02/03: CAMEL-17152: model json - Enum should be in the
order defined in the source.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 33b2d014f10d6585e78b6431ffbe0fd9d183f571
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Oct 31 10:12:46 2021 +0100
CAMEL-17152: model json - Enum should be in the order defined in the source.
---
.../java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
index 0971095..4efe0f8 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SchemaGeneratorMojo.java
@@ -398,15 +398,18 @@ public class SchemaGeneratorMojo extends AbstractGeneratorMojo {
required = findRequired(fieldElement, required);
// gather enums
- Set<String> enums = new TreeSet<>();
+ Set<String> enums;
boolean isEnum;
if (metadata != null && !Strings.isNullOrEmpty(metadata.enums())) {
+ // use the order from the metadata
+ enums = new LinkedHashSet<>();
isEnum = true;
String[] values = metadata.enums().split(",");
for (String val : values) {
enums.add(val.trim());
}
} else {
+ enums = new TreeSet<>(); // sort the enums A..Z
isEnum = fieldTypeElement.isEnum();
if (isEnum) {
for (Object val : fieldTypeElement.getEnumConstants()) {