This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch openapi2
in repository https://gitbox.apache.org/repos/asf/camel.git

commit cf2d5d01329a31dc2f015112a7f4cd82f050ef7c
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Mar 27 18:14:35 2024 +0100

    CAMEL-20557: Rest DSL to use openapi spec directly
---
 .../camel/catalog/components/rest-openapi.json     | 27 +++++++++++-----------
 .../org/apache/camel/catalog/models/openApi.json   |  5 ++--
 .../apache/camel/catalog/schemas/camel-spring.xsd  | 18 ++++++++++++---
 .../dsl/yaml/deserializers/ModelDeserializers.java |  6 +++++
 .../generated/resources/schema/camelYamlDsl.json   |  5 ++++
 5 files changed, 43 insertions(+), 18 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
index e224a0d248e..7c83b6b9cb4 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rest-openapi.json
@@ -27,19 +27,20 @@
     "requestValidationEnabled": { "index": 1, "kind": "property", 
"displayName": "Request Validation Enabled", "group": "common", "label": 
"common", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
false, "description": "Enable validation of requests against the configured 
OpenAPI specification" },
     "specificationUri": { "index": 2, "kind": "property", "displayName": 
"Specification Uri", "group": "common", "label": "common", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "openapi.json", 
"description": "Path to the OpenApi specification file. The scheme, host base 
path are taken from this specification, but these can be overridden with 
properties on the component or endpoint level. If  [...]
     "requestValidationCustomizer": { "index": 3, "kind": "property", 
"displayName": "Request Validation Customizer", "group": "common (advanced)", 
"label": "common,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.component.rest.openapi.validator.RequestValidationCustomizer",
 "deprecated": false, "autowired": false, "secret": false, "description": "If 
request validation is enabled, this option provides the capability to customize 
the creation of OpenApiInterac [...]
-    "bridgeErrorHandler": { "index": 4, "kind": "property", "displayName": 
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Allows for bridging the consumer to the Camel routing Error Handler, which 
mean any exceptions (if possible) occurred while the Camel consumer is trying 
to pickup incoming messages, or the like [...]
-    "missingOperation": { "index": 5, "kind": "property", "displayName": 
"Missing Operation", "group": "consumer", "label": "consumer", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail", 
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore 
or return a mock response for OpenAPI operations that are not mapped to a 
corresponding route." },
-    "consumerComponentName": { "index": 6, "kind": "property", "displayName": 
"Consumer Component Name", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Name of the Camel component that will service the requests. The 
component must be present in Camel registry and it must implement 
RestOpenApiConsumerFactory service provider interfac [...]
-    "mockIncludePattern": { "index": 7, "kind": "property", "displayName": 
"Mock Include Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive 
filtering of mock data from directories. The pattern is using Ant-path style 
pattern. Multiple patterns can be specified sepa [...]
-    "restOpenapiProcessorStrategy": { "index": 8, "kind": "property", 
"displayName": "Rest Openapi Processor Strategy", "group": "consumer 
(advanced)", "label": "consumer,advanced", "required": false, "type": "object", 
"javaType": 
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
use a custom strategy for how to process Rest DSL requests" },
-    "host": { "index": 9, "kind": "property", "displayName": "Host", "group": 
"producer", "label": "producer", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Scheme hostname and port to direct the HTTP 
requests to in the form of https:\/\/hostname:port. Can be configured at the 
endpoint, component or in the corresponding REST configuration in the Camel 
Context. If you give this component a nam [...]
-    "lazyStartProducer": { "index": 10, "kind": "property", "displayName": 
"Lazy Start Producer", "group": "producer", "label": "producer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Whether the producer should be started lazy (on the first message). By 
starting lazy you can use this to allow CamelContext and routes to startup in 
situations where a producer may otherwise fai [...]
-    "componentName": { "index": 11, "kind": "property", "displayName": 
"Component Name", "group": "producer (advanced)", "label": "producer,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Name 
of the Camel component that will perform the requests. The component must be 
present in Camel registry and it must implement RestProducerFactory service 
provider interface. If not set CLASSPATH [...]
-    "consumes": { "index": 12, "kind": "property", "displayName": "Consumes", 
"group": "producer (advanced)", "label": "producer,advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "What payload type this 
component capable of consuming. Could be one type, like application\/json or 
multiple types as application\/json, application\/xml; q=0.5 according to the 
RFC7231. This equates to the va [...]
-    "produces": { "index": 13, "kind": "property", "displayName": "Produces", 
"group": "producer (advanced)", "label": "producer,advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "What payload type this 
component is producing. For example application\/json according to the RFC7231. 
This equates to the value of Content-Type HTTP header. If set overrides any 
value present in the OpenApi s [...]
-    "autowiredEnabled": { "index": 14, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching  [...]
-    "sslContextParameters": { "index": 15, "kind": "property", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "description": "Customize TLS parameters 
used by the component. If not set defaults to the TLS parameters set in the 
Camel context" },
-    "useGlobalSslContextParameters": { "index": 16, "kind": "property", 
"displayName": "Use Global Ssl Context Parameters", "group": "security", 
"label": "security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Enable usage of global SSL context 
parameters." }
+    "apiContextPath": { "index": 4, "kind": "property", "displayName": "Api 
Context Path", "group": "consumer", "label": "consumer", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Sets the context-path to 
use for servicing the OpenAPI specification" },
+    "bridgeErrorHandler": { "index": 5, "kind": "property", "displayName": 
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Allows for bridging the consumer to the Camel routing Error Handler, which 
mean any exceptions (if possible) occurred while the Camel consumer is trying 
to pickup incoming messages, or the like [...]
+    "missingOperation": { "index": 6, "kind": "property", "displayName": 
"Missing Operation", "group": "consumer", "label": "consumer", "required": 
false, "type": "string", "javaType": "java.lang.String", "enum": [ "fail", 
"ignore", "mock" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "fail", "description": "Whether the consumer should fail,ignore 
or return a mock response for OpenAPI operations that are not mapped to a 
corresponding route." },
+    "consumerComponentName": { "index": 7, "kind": "property", "displayName": 
"Consumer Component Name", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Name of the Camel component that will service the requests. The 
component must be present in Camel registry and it must implement 
RestOpenApiConsumerFactory service provider interfac [...]
+    "mockIncludePattern": { "index": 8, "kind": "property", "displayName": 
"Mock Include Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "classpath:camel-mock\/**", "description": "Used for inclusive 
filtering of mock data from directories. The pattern is using Ant-path style 
pattern. Multiple patterns can be specified sepa [...]
+    "restOpenapiProcessorStrategy": { "index": 9, "kind": "property", 
"displayName": "Rest Openapi Processor Strategy", "group": "consumer 
(advanced)", "label": "consumer,advanced", "required": false, "type": "object", 
"javaType": 
"org.apache.camel.component.rest.openapi.RestOpenapiProcessorStrategy", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
use a custom strategy for how to process Rest DSL requests" },
+    "host": { "index": 10, "kind": "property", "displayName": "Host", "group": 
"producer", "label": "producer", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Scheme hostname and port to direct the HTTP 
requests to in the form of https:\/\/hostname:port. Can be configured at the 
endpoint, component or in the corresponding REST configuration in the Camel 
Context. If you give this component a na [...]
+    "lazyStartProducer": { "index": 11, "kind": "property", "displayName": 
"Lazy Start Producer", "group": "producer", "label": "producer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Whether the producer should be started lazy (on the first message). By 
starting lazy you can use this to allow CamelContext and routes to startup in 
situations where a producer may otherwise fai [...]
+    "componentName": { "index": 12, "kind": "property", "displayName": 
"Component Name", "group": "producer (advanced)", "label": "producer,advanced", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Name 
of the Camel component that will perform the requests. The component must be 
present in Camel registry and it must implement RestProducerFactory service 
provider interface. If not set CLASSPATH [...]
+    "consumes": { "index": 13, "kind": "property", "displayName": "Consumes", 
"group": "producer (advanced)", "label": "producer,advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "What payload type this 
component capable of consuming. Could be one type, like application\/json or 
multiple types as application\/json, application\/xml; q=0.5 according to the 
RFC7231. This equates to the va [...]
+    "produces": { "index": 14, "kind": "property", "displayName": "Produces", 
"group": "producer (advanced)", "label": "producer,advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "What payload type this 
component is producing. For example application\/json according to the RFC7231. 
This equates to the value of Content-Type HTTP header. If set overrides any 
value present in the OpenApi s [...]
+    "autowiredEnabled": { "index": 15, "kind": "property", "displayName": 
"Autowired Enabled", "group": "advanced", "label": "advanced", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Whether autowiring is enabled. This is used for automatic autowiring options 
(the option must be marked as autowired) by looking up in the registry to find 
if there is a single instance of matching  [...]
+    "sslContextParameters": { "index": 16, "kind": "property", "displayName": 
"Ssl Context Parameters", "group": "security", "label": "security", "required": 
false, "type": "object", "javaType": 
"org.apache.camel.support.jsse.SSLContextParameters", "deprecated": false, 
"autowired": false, "secret": false, "description": "Customize TLS parameters 
used by the component. If not set defaults to the TLS parameters set in the 
Camel context" },
+    "useGlobalSslContextParameters": { "index": 17, "kind": "property", 
"displayName": "Use Global Ssl Context Parameters", "group": "security", 
"label": "security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Enable usage of global SSL context 
parameters." }
   },
   "properties": {
     "specificationUri": { "index": 0, "kind": "path", "displayName": 
"Specification Uri", "group": "common", "label": "common", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "openapi.json", 
"description": "Path to the OpenApi specification file. The scheme, host base 
path are taken from this specification, but these can be overridden with 
properties on the component or endpoint level. If not  [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
index f1292c7c300..2d064458544 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/openApi.json
@@ -17,7 +17,8 @@
     "disabled": { "index": 2, "kind": "attribute", "displayName": "Disabled", 
"label": "advanced", "required": false, "type": "boolean", "javaType": 
"java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether to disable all the REST services 
from the OpenAPI contract from the route during build time. Once an REST 
service has been disabled then it cannot be enabled later at runtime." },
     "specification": { "index": 3, "kind": "attribute", "displayName": 
"Specification", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Path to the OpenApi specification file." },
     "routeId": { "index": 4, "kind": "attribute", "displayName": "Route Id", 
"required": false, "type": "string", "javaType": "java.lang.String", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the id of the route" },
-    "missingOperation": { "index": 5, "kind": "attribute", "displayName": 
"Missing Operation", "required": false, "type": "enum", "javaType": 
"java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "fail", "description": 
"Whether to fail, ignore or return a mock response for OpenAPI operations that 
are not mapped to a corresponding route." },
-    "mockIncludePattern": { "index": 6, "kind": "attribute", "displayName": 
"Mock Include Pattern", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "classpath:camel-mock\/**", 
"description": "Used for inclusive filtering of mock data from directories. The 
pattern is using Ant-path style pattern. Multiple patterns can be specified 
separated by comma." }
+    "requestValidationEnabled": { "index": 5, "kind": "attribute", 
"displayName": "Request Validation Enabled", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "description": "Whether to 
enable validation of the client request to check that the request contains 
valid and expected data." },
+    "missingOperation": { "index": 6, "kind": "attribute", "displayName": 
"Missing Operation", "required": false, "type": "enum", "javaType": 
"java.lang.String", "enum": [ "fail", "ignore", "mock" ], "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": "fail", "description": 
"Whether to fail, ignore or return a mock response for OpenAPI operations that 
are not mapped to a corresponding route." },
+    "mockIncludePattern": { "index": 7, "kind": "attribute", "displayName": 
"Mock Include Pattern", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "classpath:camel-mock\/**", 
"description": "Used for inclusive filtering of mock data from directories. The 
pattern is using Ant-path style pattern. Multiple patterns can be specified 
separated by comma." }
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index d800a098830..745fd32593f 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -16387,7 +16387,9 @@ The flow used by the OAuth2 security scheme. Valid 
values are implicit, password
   <xs:complexType name="openApiDefinition">
     <xs:complexContent>
       <xs:extension base="tns:optionalIdentifiedDefinition">
-        <xs:sequence/>
+        <xs:sequence>
+          <xs:element minOccurs="0" name="apiContextPath" type="xs:string"/>
+        </xs:sequence>
         <xs:attribute name="specification" type="xs:string" use="required">
           <xs:annotation>
             <xs:documentation xml:lang="en">
@@ -16412,6 +16414,16 @@ Sets the id of the route.
 <![CDATA[
 Whether to disable all the REST services from the OpenAPI contract from the 
route during build time. Once an REST
 service has been disabled then it cannot be enabled later at runtime. Default 
value: false
+]]>
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="requestValidationEnabled" type="xs:string">
+          <xs:annotation>
+            <xs:documentation xml:lang="en">
+<![CDATA[
+Whether to enable validation of the client request to check that the request 
contains valid and expected data. Default
+value: false
 ]]>
             </xs:documentation>
           </xs:annotation>
@@ -16757,8 +16769,8 @@ or camel-netty-http that includes a HTTP server.
       <xs:annotation>
         <xs:documentation xml:lang="en">
 <![CDATA[
-Sets a leading API context-path the REST API services will be using. This can 
be used when using components such as
-camel-servlet where the deployed web application is deployed using a 
context-path.
+Sets a leading context-path the REST API will be using. This can be used when 
using components such as camel-servlet
+where the deployed web application is deployed using a context-path.
 ]]>
         </xs:documentation>
       </xs:annotation>
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 53d3374a1d2..a987d4bdd4b 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -10362,6 +10362,7 @@ public final class ModelDeserializers extends 
YamlDeserializerSupport {
                     @YamlProperty(name = "id", type = "string", description = 
"Sets the id of this node", displayName = "Id"),
                     @YamlProperty(name = "missingOperation", type = 
"enum:fail,ignore,mock", defaultValue = "fail", description = "Whether to fail, 
ignore or return a mock response for OpenAPI operations that are not mapped to 
a corresponding route.", displayName = "Missing Operation"),
                     @YamlProperty(name = "mockIncludePattern", type = 
"string", defaultValue = "classpath:camel-mock/**", description = "Used for 
inclusive filtering of mock data from directories. The pattern is using 
Ant-path style pattern. Multiple patterns can be specified separated by 
comma.", displayName = "Mock Include Pattern"),
+                    @YamlProperty(name = "requestValidationEnabled", type = 
"boolean", description = "Whether to enable validation of the client request to 
check that the request contains valid and expected data.", displayName = 
"Request Validation Enabled"),
                     @YamlProperty(name = "routeId", type = "string", 
description = "Sets the id of the route", displayName = "Route Id"),
                     @YamlProperty(name = "specification", type = "string", 
required = true, description = "Path to the OpenApi specification file.", 
displayName = "Specification")
             }
@@ -10396,6 +10397,11 @@ public final class ModelDeserializers extends 
YamlDeserializerSupport {
                     target.setMockIncludePattern(val);
                     break;
                 }
+                case "requestValidationEnabled": {
+                    String val = asText(node);
+                    target.setRequestValidationEnabled(val);
+                    break;
+                }
                 case "routeId": {
                     String val = asText(node);
                     target.setRouteId(val);
diff --git 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index e03199e5b61..c790de79194 100644
--- 
a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++ 
b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -14702,6 +14702,11 @@
             "description" : "Used for inclusive filtering of mock data from 
directories. The pattern is using Ant-path style pattern. Multiple patterns can 
be specified separated by comma.",
             "default" : "classpath:camel-mock/**"
           },
+          "requestValidationEnabled" : {
+            "type" : "boolean",
+            "title" : "Request Validation Enabled",
+            "description" : "Whether to enable validation of the client 
request to check that the request contains valid and expected data."
+          },
           "routeId" : {
             "type" : "string",
             "title" : "Route Id",

Reply via email to