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 d2f1e31090ec671521906c48cf37acc86344d8f0
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon Mar 25 17:00:52 2024 +0100

    CAMEL-20557: Rest DSL to use openapi spec directly
---
 .../camel/catalog/components/rest-openapi.json     | 38 ++++++++++++----------
 .../dsl/RestOpenApiEndpointBuilderFactory.java     | 18 ++++++++++
 .../camel/kotlin/components/RestOpenapiUriDsl.kt   |  8 +++++
 3 files changed, 46 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 e4b0b0ac3fb..aefaf840aac 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
@@ -30,15 +30,16 @@
     "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 [...]
-    "restOpenapiProcessorStrategy": { "index": 7, "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": 8, "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": 9, "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 fail [...]
-    "componentName": { "index": 10, "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": 11, "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": 12, "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": 13, "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": 14, "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": 15, "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." }
+    "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 separ [...]
+    "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." }
   },
   "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  [...]
@@ -49,14 +50,15 @@
     "consumerComponentName": { "index": 5, "kind": "parameter", "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 interfa [...]
     "exceptionHandler": { "index": 6, "kind": "parameter", "displayName": 
"Exception Handler", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By def [...]
     "exchangePattern": { "index": 7, "kind": "parameter", "displayName": 
"Exchange Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the exchange pattern when the consumer creates an exchange." },
-    "restOpenapiProcessorStrategy": { "index": 8, "kind": "parameter", 
"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" },
-    "basePath": { "index": 9, "kind": "parameter", "displayName": "Base Path", 
"group": "producer", "label": "producer", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "API basePath, for example \/v3. Default is 
unset, if set overrides the value present in OpenApi specification and in the 
component configuration." },
-    "consumes": { "index": 10, "kind": "parameter", "displayName": "Consumes", 
"group": "producer", "label": "producer", "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 value of Accept HTTP  [...]
-    "host": { "index": 11, "kind": "parameter", "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 n [...]
-    "produces": { "index": 12, "kind": "parameter", "displayName": "Produces", 
"group": "producer", "label": "producer", "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 specification. Overr [...]
-    "componentName": { "index": 13, "kind": "parameter", "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 CLASSPAT [...]
-    "lazyStartProducer": { "index": 14, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "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 produ [...]
-    "requestValidationCustomizer": { "index": 15, "kind": "parameter", 
"displayName": "Request Validation Customizer", "group": "advanced", "label": 
"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 OpenApiInteractionValidator  [...]
-    "requestValidationLevels": { "index": 16, "kind": "parameter", 
"displayName": "Request Validation Levels", "group": "advanced", "label": 
"advanced", "required": false, "type": "object", "javaType": 
"java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.", 
"multiValue": true, "deprecated": false, "autowired": false, "secret": false, 
"description": "Levels for specific OpenAPI request validation options. 
Multiple options can be specified as URI options prefixed by ' [...]
+    "mockIncludePattern": { "index": 8, "kind": "parameter", "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": "parameter", 
"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" },
+    "basePath": { "index": 10, "kind": "parameter", "displayName": "Base 
Path", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "API basePath, for example \/v3. Default 
is unset, if set overrides the value present in OpenApi specification and in 
the component configuration." },
+    "consumes": { "index": 11, "kind": "parameter", "displayName": "Consumes", 
"group": "producer", "label": "producer", "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 value of Accept HTTP  [...]
+    "host": { "index": 12, "kind": "parameter", "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 n [...]
+    "produces": { "index": 13, "kind": "parameter", "displayName": "Produces", 
"group": "producer", "label": "producer", "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 specification. Overr [...]
+    "componentName": { "index": 14, "kind": "parameter", "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 CLASSPAT [...]
+    "lazyStartProducer": { "index": 15, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "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 produ [...]
+    "requestValidationCustomizer": { "index": 16, "kind": "parameter", 
"displayName": "Request Validation Customizer", "group": "advanced", "label": 
"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 OpenApiInteractionValidator  [...]
+    "requestValidationLevels": { "index": 17, "kind": "parameter", 
"displayName": "Request Validation Levels", "group": "advanced", "label": 
"advanced", "required": false, "type": "object", "javaType": 
"java.util.Map<java.lang.String, java.lang.Object>", "prefix": "validation.", 
"multiValue": true, "deprecated": false, "autowired": false, "secret": false, 
"description": "Levels for specific OpenAPI request validation options. 
Multiple options can be specified as URI options prefixed by ' [...]
   }
 }
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
index 78546192e62..6df772e3026 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RestOpenApiEndpointBuilderFactory.java
@@ -251,6 +251,24 @@ public interface RestOpenApiEndpointBuilderFactory {
             doSetProperty("exchangePattern", exchangePattern);
             return this;
         }
+        /**
+         * 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.
+         * 
+         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * 
+         * Default: classpath:camel-mock/*
+         * Group: consumer (advanced)
+         * 
+         * @param mockIncludePattern the value to set
+         * @return the dsl builder
+         */
+        default AdvancedRestOpenApiEndpointConsumerBuilder mockIncludePattern(
+                String mockIncludePattern) {
+            doSetProperty("mockIncludePattern", mockIncludePattern);
+            return this;
+        }
         /**
          * To use a custom strategy for how to process Rest DSL requests.
          * 
diff --git 
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
 
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
index a4e550f2223..038f1cc4836 100644
--- 
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
+++ 
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/RestOpenapiUriDsl.kt
@@ -147,6 +147,14 @@ public class RestOpenapiUriDsl(
     it.property("exchangePattern", exchangePattern)
   }
 
+  /**
+   * 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.
+   */
+  public fun mockIncludePattern(mockIncludePattern: String) {
+    it.property("mockIncludePattern", mockIncludePattern)
+  }
+
   /**
    * To use a custom strategy for how to process Rest DSL requests
    */

Reply via email to