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 ea1dacedaeb08b016803e0c50046894efb0a989b
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Thu Feb 17 15:52:31 2022 +0100

    CAMEL-17673: camel-core-model - Cleanup Rest DSL
---
 .../resources/org/apache/camel/model/rest/rest.json       |  2 +-
 .../org/apache/camel/model/rest/restBinding.json          |  2 +-
 .../apache/camel/model/rest/RestBindingDefinition.java    | 15 +--------------
 .../java/org/apache/camel/model/rest/RestDefinition.java  | 13 +------------
 .../org/apache/camel/reifier/rest/RestBindingReifier.java |  2 +-
 5 files changed, 5 insertions(+), 29 deletions(-)

diff --git 
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
 
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
index c3e6ac4..4fdce04 100644
--- 
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
+++ 
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/rest.json
@@ -16,7 +16,7 @@
     "tag": { "kind": "attribute", "displayName": "Tag", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "To configure a special tag 
for the operations within this rest definition." },
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "To define the content type 
what the REST service consumes (accept as input), such as application\/xml or 
application\/json. This option will override what may be configured on a parent 
level" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "To define the content type 
what the REST service produces (uses for output), such as application\/xml or 
application\/json This option will override what may be configured on a parent 
level" },
-    "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"auto", "description": "Sets the binding mode to use. This option will override 
what may be configured on a parent level The default value is auto" },
+    "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", 
"required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ 
"off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "off", "description": "Sets the binding 
mode to use. This option will override what may be configured on a parent level 
The default value is auto" },
     "skipBindingOnErrorCode": { "kind": "attribute", "displayName": "Skip 
Binding On Error Code", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Whether to skip binding on output if there is a custom HTTP 
error code header. This allows to build custom error messages that do not bind 
to json \/ xml etc, as success messages otherwise will do. This option will 
override what may be configured on a [...]
     "clientRequestValidation": { "kind": "attribute", "displayName": "Client 
Request Validation", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Whether to enable validation of the client request to check: 1) 
Content-Type header matches what the Rest DSL consumes; returns HTTP Status 415 
if validation error. 2) Accept header matches what the Rest DSL produces; 
returns HTTP Status 406 if valida [...]
     "enableCORS": { "kind": "attribute", "displayName": "Enable CORS", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": 
"Whether to enable CORS headers in the HTTP response. This option will override 
what may be configured on a parent level The default value is false." },
diff --git 
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/restBinding.json
 
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/restBinding.json
index e6172ba..294fa8c 100644
--- 
a/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/restBinding.json
+++ 
b/core/camel-core-model/src/generated/resources/org/apache/camel/model/rest/restBinding.json
@@ -14,7 +14,7 @@
   "properties": {
     "consumes": { "kind": "attribute", "displayName": "Consumes", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "To define the content type 
what the REST service consumes (accept as input), such as application\/xml or 
application\/json" },
     "produces": { "kind": "attribute", "displayName": "Produces", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "To define the content type 
what the REST service produces (uses for output), such as application\/xml or 
application\/json" },
-    "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"off", "description": "Sets the binding mode to use. The default value is off" 
},
+    "bindingMode": { "kind": "attribute", "displayName": "Binding Mode", 
"required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ 
"off", "auto", "json", "xml", "json_xml" ], "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "off", "description": "Sets the binding 
mode to use. The default value is off" },
     "type": { "kind": "attribute", "displayName": "Type", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the class name to use 
for binding from input to POJO for the incoming data The name of the class of 
the input data. Append a to the end of the name if you want the input to be an 
array type." },
     "outType": { "kind": "attribute", "displayName": "Out Type", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the class name to use 
for binding from POJO to output for the outgoing data The name of the class of 
the input data. Append a to the end of the name if you want the input to be an 
array type." },
     "skipBindingOnErrorCode": { "kind": "attribute", "displayName": "Skip 
Binding On Error Code", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Whether to skip binding on output if there is a custom HTTP 
error code header. This allows to build custom error messages that do not bind 
to json \/ xml etc, as success messages otherwise will do." },
diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
index fd62745..163b23f 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -40,47 +40,34 @@ public class RestBindingDefinition extends 
OptionalIdentifiedDefinition<RestBind
 
     @XmlTransient
     private Map<String, String> defaultValues;
-
     @XmlTransient
     private Boolean requiredBody;
-
     @XmlTransient
     private Set<String> requiredHeaders;
-
     @XmlTransient
     private Set<String> requiredQueryParameters;
 
     @XmlAttribute
     private String consumes;
-
     @XmlAttribute
     private String produces;
-
     @XmlAttribute
-    @Metadata(defaultValue = "off")
+    @Metadata(defaultValue = "off", enums = "off,auto,json,xml,json_xml")
     private String bindingMode;
-
     @XmlAttribute
     private String type;
-
     @XmlTransient
     private Class<?> typeClass;
-
     @XmlAttribute
     private String outType;
-
     @XmlTransient
     private Class<?> outTypeClass;
-
     @XmlAttribute
     private String skipBindingOnErrorCode;
-
     @XmlAttribute
     private String clientRequestValidation;
-
     @XmlAttribute
     private String enableCORS;
-
     @XmlAttribute
     private String component;
 
diff --git 
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
 
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 3a06891..85684e0a3 100644
--- 
a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ 
b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -57,38 +57,27 @@ public class RestDefinition extends 
OptionalIdentifiedDefinition<RestDefinition>
 
     @XmlAttribute
     private String path;
-
     @XmlAttribute
     private String tag;
-
     @XmlAttribute
     private String consumes;
-
     @XmlAttribute
     private String produces;
-
     @XmlAttribute
-    @Metadata(defaultValue = "auto")
+    @Metadata(defaultValue = "off", enums = "off,auto,json,xml,json_xml")
     private String bindingMode;
-
     @XmlAttribute
     private String skipBindingOnErrorCode;
-
     @XmlAttribute
     private String clientRequestValidation;
-
     @XmlAttribute
     private String enableCORS;
-
     @XmlAttribute
     private String apiDocs;
-
     @XmlElement(name = "securityDefinitions") // use the name Swagger/OpenAPI 
uses
     private RestSecuritiesDefinition securityDefinitions;
-
     @XmlElement(name = "securityRequirements") // use the name Swagger/OpenAPI 
uses
     private RestSecuritiesRequirement securityRequirements;
-
     @XmlElementRef
     private List<VerbDefinition> verbs = new ArrayList<>();
 
diff --git 
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
 
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
index ed3f20b..268df59 100644
--- 
a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
+++ 
b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/rest/RestBindingReifier.java
@@ -64,7 +64,7 @@ public class RestBindingReifier extends AbstractReifier {
         Map<String, String> corsHeaders = config.getCorsHeaders();
 
         if ("off".equals(mode)) {
-            // binding mode is off, so create a off mode binding processor
+            // binding mode is off, so create off mode binding processor
             return new RestBindingAdvice(
                     camelContext, null, null, null, null,
                     parseString(definition.getConsumes()), 
parseString(definition.getProduces()), mode, skip, validation, cors,

Reply via email to