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
The following commit(s) were added to refs/heads/main by this push:
new 36042f2e8c85 chore: camel-jbang - sync the bundled examples:
openapi-client turns on client request validation
36042f2e8c85 is described below
commit 36042f2e8c85cd1117d41dfa2f2f3963b5590290
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Oct 4 16:36:30 2026 +0200
chore: camel-jbang - sync the bundled examples: openapi-client turns on
client request validation
Synced with the sync-example-catalog profile after
apache/camel-jbang-examples#96:
camel.component.rest-openapi.request-validation-enabled=true in the
example's
application.properties, so a call without a value for a path parameter fails
before it is sent (CAMEL-25321), and the README explains it.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
---
.../main/resources/examples/contracts/openapi-client/README.md | 9 +++++++--
.../examples/contracts/openapi-client/application.properties | 4 ++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
index bee062478acc..5290ffeda488 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/README.md
@@ -44,6 +44,10 @@ can be repeated. `stock.api.url` in `application.properties`
says where the serv
`POST /api/stock/{sku}/reserve`. `host` is the server; `componentName: http`
picks the HTTP client to use.
- The path parameter `sku` is taken from the header of the same name; the
request body is the message body,
built here as the JSON the contract's `Reservation` schema describes.
+- Client request validation is on
(`camel.component.rest-openapi.request-validation-enabled=true` in
+ `application.properties`): a call without a value for a path parameter, a
required header or query parameter,
+ or a required body is refused before it is sent, with a message that names
what is missing, instead of going out
+ with `{sku}` in the path.
- The order id and SKU are also kept in exchange properties for the log, since
the response replaces the body
and headers are sent on the wire, as the `http-client` example explains.
- A 409 or 400 from the server is an `HttpOperationFailedException`; the
`onException` logs its status code
@@ -58,8 +62,9 @@ can be repeated. `stock.api.url` in `application.properties`
says where the serv
## Try changing
-- Set `requestValidationEnabled: true` on the endpoint and send a reservation
without `qty`: the client
- refuses it before any HTTP call.
+- Remove the `sku` header before the call: the validation refuses it with
"Path parameter 'sku' is required but
+ none found" before any HTTP call. Turn the validation off in
`application.properties` and the request goes out
+ with `{sku}` in the path and gets a 404.
- Point `stock.api.url` at a server that is not running and watch the
connection error reach the error handler.
- Replace the contract's server with a public one,
`https://petstore3.swagger.io/api/v3/openapi.json`, and
call `getPetById`.
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/application.properties
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/application.properties
index cfc23ac075c7..d64c81e2883a 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/application.properties
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/contracts/openapi-client/application.properties
@@ -16,3 +16,7 @@
# under the License.
stock.api.url=http://localhost:8080
+
+# client request validation: a request without a required body, header, query
or path parameter is refused before
+# it is sent (a line without a sku header would otherwise be sent as
/stock/{sku}/reserve)
+camel.component.rest-openapi.request-validation-enabled=true