You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2026/02/18 12:14:33 UTC

(camel-kamelets) branch main updated: rest-openapi-sink kamelet - Add option to configure host and basePath option and validation of request (#2729)

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

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 8c79210a1 rest-openapi-sink kamelet - Add option to configure host and basePath option and validation of request (#2729)
8c79210a1 is described below

commit 8c79210a1cc26bc69820d3394c3244a2700c639c
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Feb 18 13:14:28 2026 +0100

    rest-openapi-sink kamelet - Add option to configure host and basePath option and validation of request (#2729)
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../partials/rest-openapi-sink-description.adoc    |  6 +++++-
 kamelets/rest-openapi-sink.kamelet.yaml            | 22 +++++++++++++++++++++-
 .../kamelets/rest-openapi-sink.kamelet.yaml        | 22 +++++++++++++++++++++-
 3 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/docs/modules/ROOT/partials/rest-openapi-sink-description.adoc b/docs/modules/ROOT/partials/rest-openapi-sink-description.adoc
index cd9189308..6d7bf8ba7 100644
--- a/docs/modules/ROOT/partials/rest-openapi-sink-description.adoc
+++ b/docs/modules/ROOT/partials/rest-openapi-sink-description.adoc
@@ -12,9 +12,13 @@ Uses OpenAPI specifications to understand API endpoints, request/response format
 
 Supports various HTTP operations (GET, POST, PUT, DELETE, etc.) as defined in the OpenAPI specification, providing comprehensive REST API integration capabilities.
 
+=== Host and Base Path Configuration
+
+The host and base path for the REST service can be configured to override the default values found in the OpenAPI specification. This is useful for production environments where the specification may contain default values like localhost:8080 that need to be replaced with the actual service endpoint.
+
 === Schema Validation
 
-OpenAPI specifications include schema definitions that can be used for request and response validation, ensuring data integrity and API compliance.
+OpenAPI specifications include schema definitions that can be used for request and response validation, ensuring data integrity and API compliance. Client request validation can be enabled to check if outgoing requests conform to the OpenAPI specification before they are sent.
 
 === Documentation-Driven Development
 
diff --git a/kamelets/rest-openapi-sink.kamelet.yaml b/kamelets/rest-openapi-sink.kamelet.yaml
index 6c11c8f93..b0054948a 100644
--- a/kamelets/rest-openapi-sink.kamelet.yaml
+++ b/kamelets/rest-openapi-sink.kamelet.yaml
@@ -46,6 +46,21 @@ spec:
         title: Operation ID
         description: The operation to call.
         type: string
+      host:
+        title: Host
+        description: The host to use for calling the REST service. Overrides the value found in the OpenAPI specification. The format is https://hostname:port.
+        type: string
+        example: "https://api.example.com:443"
+      basePath:
+        title: Base Path
+        description: The API base path. Overrides the value present in the OpenAPI specification.
+        type: string
+        example: "/v3"
+      clientRequestValidation:
+        title: Client Request Validation
+        description: Whether to enable validation of the client request to check if the incoming request is valid according to the OpenAPI specification.
+        type: boolean
+        default: false
   dependencies:
   - "camel:rest-openapi"
   - "camel:http"
@@ -55,4 +70,9 @@ spec:
     from:
       uri: kamelet:source
       steps:
-      - to: "rest-openapi:{{specification}}#{{operation}}"
+      - to:
+          uri: "rest-openapi:{{specification}}#{{operation}}"
+          parameters:
+            host: "{{?host}}"
+            basePath: "{{?basePath}}"
+            clientRequestValidation: "{{clientRequestValidation}}"
diff --git a/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml b/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
index 6c11c8f93..b0054948a 100644
--- a/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
+++ b/library/camel-kamelets/src/main/resources/kamelets/rest-openapi-sink.kamelet.yaml
@@ -46,6 +46,21 @@ spec:
         title: Operation ID
         description: The operation to call.
         type: string
+      host:
+        title: Host
+        description: The host to use for calling the REST service. Overrides the value found in the OpenAPI specification. The format is https://hostname:port.
+        type: string
+        example: "https://api.example.com:443"
+      basePath:
+        title: Base Path
+        description: The API base path. Overrides the value present in the OpenAPI specification.
+        type: string
+        example: "/v3"
+      clientRequestValidation:
+        title: Client Request Validation
+        description: Whether to enable validation of the client request to check if the incoming request is valid according to the OpenAPI specification.
+        type: boolean
+        default: false
   dependencies:
   - "camel:rest-openapi"
   - "camel:http"
@@ -55,4 +70,9 @@ spec:
     from:
       uri: kamelet:source
       steps:
-      - to: "rest-openapi:{{specification}}#{{operation}}"
+      - to:
+          uri: "rest-openapi:{{specification}}#{{operation}}"
+          parameters:
+            host: "{{?host}}"
+            basePath: "{{?basePath}}"
+            clientRequestValidation: "{{clientRequestValidation}}"