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-jbang-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new c9453d4  CAMEL-25517: openapi-server keeps the reservation in a 
variable (#106)
c9453d4 is described below

commit c9453d436ff10843177767630b667dbee7403d57
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Oct 10 10:44:17 2026 +0200

    CAMEL-25517: openapi-server keeps the reservation in a variable (#106)
    
    Camel favours variables for the values a route keeps for itself.
    
    
    Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
    
    Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
 camel-jbang-example-catalog.json                   |  2 +-
 contracts/openapi-server/metadata.json             |  2 +-
 contracts/openapi-server/openapi-server.camel.yaml | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/camel-jbang-example-catalog.json b/camel-jbang-example-catalog.json
index fbb847c..073e052 100644
--- a/camel-jbang-example-catalog.json
+++ b/camel-jbang-example-catalog.json
@@ -726,7 +726,7 @@
                 "onException",
                 "marshal",
                 "unmarshal",
-                "setProperty"
+                "setVariable"
             ],
             "languages": [
                 "simple",
diff --git a/contracts/openapi-server/metadata.json 
b/contracts/openapi-server/metadata.json
index 07a2707..20456f6 100644
--- a/contracts/openapi-server/metadata.json
+++ b/contracts/openapi-server/metadata.json
@@ -17,7 +17,7 @@
             "onException",
             "marshal",
             "unmarshal",
-            "setProperty"
+            "setVariable"
         ],
         "languages": [
             "simple",
diff --git a/contracts/openapi-server/openapi-server.camel.yaml 
b/contracts/openapi-server/openapi-server.camel.yaml
index d2f497b..894c6b2 100644
--- a/contracts/openapi-server/openapi-server.camel.yaml
+++ b/contracts/openapi-server/openapi-server.camel.yaml
@@ -83,7 +83,7 @@
             expression:
               simple:
                 expression: "${body[orderId]} != null && ${body[qty]} > 0"
-        - setProperty:
+        - setVariable:
             name: reservation
             expression:
               simple:
@@ -107,7 +107,7 @@
                           expression: '{"error": "unknown sku ${header.sku}"}'
               - expression:
                   simple:
-                    expression: "${body[qty]} < 
${exchangeProperty.reservation[qty]}"
+                    expression: "${body[qty]} < ${variable.reservation[qty]}"
                 steps:
                   - setHeader:
                       name: CamelHttpResponseCode
@@ -117,15 +117,15 @@
                   - setBody:
                       expression:
                         simple:
-                          expression: '{"error": "only ${body[qty]} 
${header.sku} in stock, ${exchangeProperty.reservation[qty]} wanted for 
${exchangeProperty.reservation[orderId]}"}'
+                          expression: '{"error": "only ${body[qty]} 
${header.sku} in stock, ${variable.reservation[qty]} wanted for 
${variable.reservation[orderId]}"}'
             otherwise:
               steps:
                 - log:
-                    message: "Reserved ${exchangeProperty.reservation[qty]} x 
${header.sku} for ${exchangeProperty.reservation[orderId]}"
+                    message: "Reserved ${variable.reservation[qty]} x 
${header.sku} for ${variable.reservation[orderId]}"
                 - setBody:
                     expression:
                       simple:
-                        expression: '{"sku": "${header.sku}", "reserved": 
${exchangeProperty.reservation[qty]}, "remaining": ${body[qty]}}'
+                        expression: '{"sku": "${header.sku}", "reserved": 
${variable.reservation[qty]}, "remaining": ${body[qty]}}'
 
 # Finds one SKU in the stock file: the item as a map, or null
 - route:

Reply via email to