Skip to content

chore: openapi-client turns on client request validation - #96

Merged
davsclaus merged 1 commit into
mainfrom
quick-fix/openapi-client-request-validation
Oct 4, 2026
Merged

davsclaus merged 1 commit into
mainfrom
quick-fix/openapi-client-request-validation

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

The openapi-client example now turns on client request validation for rest-openapi:

camel.component.rest-openapi.request-validation-enabled=true

A call without a value for a path parameter, a required header or query parameter, or a required body is now refused before it is sent, with a message that names what is missing. Before, it went out with the literal {sku} in the path and got a 404. The path-parameter check is new in Camel 4.23 (CAMEL-25321, apache/camel#27333). On 4.22 the validation is on but doesn't check path parameters, and the example runs the same.

Why: in the local-model benchmark, the openapi-client example with this option on sent 0 requests with {sku} in the path, against 942 without it. The model got "Path parameter 'sku' is required but none found: set the header sku, or an exchange variable of that name, before the call." instead.

README:

  • "How it works" explains the validation.
  • "Try changing" replaces the old bullet ("send a reservation without qty: the client refuses it"), which wasn't true: the validation checks that a body is there and parses, not its fields against the schema. The new bullet removes the sku header and shows the path-parameter message.

Checked by hand against the openapi-server example on 4.23.0-SNAPSHOT:

  • The orders reserve as before, including the expected 409 for CAMEL-CAP.
  • With the sku header removed, every call is refused with the path-parameter message, and no request is sent.

The Citrus test runner (camel test run) failed to start on this machine (a JUnit launcher class missing in the plugin's classpath), so CI here is the test run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m

The rest-openapi client now validates each request against the contract
before sending it (camel.component.rest-openapi.request-validation-enabled
in application.properties): a call without a value for a path parameter, a
required header or query parameter, or a required body is refused with a
message naming what is missing, instead of going out with {sku} in the path.
The path parameter check is CAMEL-25321 (Camel 4.23). The README's "Try
changing" no longer claims that a reservation without qty is refused (the
validation does not check the body against the schema).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
@davsclaus
davsclaus merged commit fba5f9c into main Oct 4, 2026
34 checks passed
@davsclaus
davsclaus deleted the quick-fix/openapi-client-request-validation branch October 4, 2026 14:34
davsclaus added a commit to apache/camel that referenced this pull request Oct 4, 2026
…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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant