davsclaus opened a new pull request, #27078:
URL: https://github.com/apache/camel/pull/27078

   Fixes the follow-ups of CAMEL-25069 (found in the review of CAMEL-25046, 
#26927).
   
   1. **clientResponseValidation was skipped** when the binding mode is `off`, 
the response has no body, there is no marshaller, or binding is skipped for an 
error code (`skipBindingOnErrorCode`), because the validation ran at the end of 
`marshal` after several early returns. The validation now runs after the 
marshalling in all cases (still not when the exchange failed).
   2. **Response headers per response code**: the headers of all 
`responseMessage`s were collected into one set and required on every response. 
They are now kept per response code 
(`RestBindingDefinition.addResponseHeader(code, name)`, passed through 
`RestBindingConfiguration` to `RestBindingAdvice`), and the headers of the 
response message of the actual code (or of the `default` one when the code has 
none) are required. The `ValidationContext` record of the SPI is unchanged; the 
old `addResponseHeader(name)` still means "required on every response".
   3. **Duplicate verb id / shared direct route**:
      - a verb id that is already used was silently replaced by a generated 
route id. It is now kept, so it fails with the usual duplicate route id error.
      - a `direct` route called by more than one rest service was inlined into 
all of them (sharing the same EIP definitions). It is now not inlined, and 
stays a route of its own that the rest services call. Throwing an error instead 
was not an option: inlining is on by default and several existing tests (and 
likely users) call one `direct` route from two rest services. The rest-dsl docs 
say so.
   4. **`type(...)` and requiredBody**: the body parameter that `type(...)` 
adds (required by default, and already required in the OpenAPI spec) was added 
after the parameters were registered on the binding, so `requiredBody` was 
never set. It is now added first, so with `clientRequestValidation` a request 
without a body is rejected (400).
   
   All five behaviour changes are in the 4.23 upgrade guide.
   
   Tests in `RestDslEdgeCasesTest`: 
`testClientResponseValidationWithBindingOff`, 
`testClientResponseValidationHeadersPerResponseCode`, `testTypeRequiresBody`, 
`testDuplicateVerbId`, `testSameDirectUsedByTwoRests`. All but the per-code 
test fail without the fix. The per-code test needs fix 1 to reach the 
validation at all, since camel-core has no JSON data format to marshal with. 
The full camel-core test suite passes (7970 tests).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to