CAMEL-24316: camel-aws2-transcribe - throw when pojoRequest=true and the body is the wrong type - #25250
Conversation
…the body is the wrong type Child of CAMEL-24261. Transcribe2Producer's 30 operations only acted when the body was the matching request type under pojoRequest=true; any other body silently fell through with no AWS call and no error. Add the missing else that throws IllegalArgumentException naming the required type, consistent with CAMEL-23462. This is separate from CAMEL-24207, which implemented the previously-empty operation stubs. A new parameterized test (Transcribe2ProducerPojoRequestTest) covers all 30 operations; verified to fail (silent no-op) before the fix. The shared 4.22 upgrade-guide entry was added with CAMEL-24263. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 tested, 29 compile-only — current: 9 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 9).
|
gnodet
left a comment
There was a problem hiding this comment.
Clean, well-structured defensive-programming fix identical in pattern to the approved and merged sibling PR #25243 (Rekognition). All 30 operations in the Transcribe2Operations enum get a matching else throw IllegalArgumentException in the producer and a corresponding entry in the parameterized test. The test uses @ParameterizedTest + @CsvSource with AssertJ assertThatThrownBy, package-private visibility, and covers all 30 enum operations. Pattern and conventions are consistent across the CAMEL-24261 series. CI is green. ✅
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Child of CAMEL-24261 (completing CAMEL-23462 across the AWS2 producers).
Problem
With
pojoRequest=true,Transcribe2Producer's 30 operations only acted whenthe body was the matching request type; any other body fell through the
instanceofwith noelse, so no AWS call was made, no response was set, andthe original body was returned with no error.
This is distinct from CAMEL-24207, which implemented the previously-empty
operation stubs — here the operations work, but the pojo-mode path silently
dropped a wrong-typed body.
Fix
Each branch now throws
IllegalArgumentExceptionnaming the required requesttype, e.g.
"createVocabulary operation requires CreateVocabularyRequest in POJO mode".Tests
A new
Transcribe2ProducerPojoRequestTestuses a@ParameterizedTestcoveringall 30 operations, sending a wrong-typed body to
pojoRequest=trueroutes andasserting each message. Verified to fail (silent no-op) before the fix — with the
createVocabularyelse removed, exactly that case reports "Expecting code toraise a throwable". 30/30 green. Hermetic unit tests, region-free — no localstack
or real AWS.
Docs / backport
The shared 4.22 upgrade-guide entry was added with CAMEL-24263. Main only, matching
the CAMEL-23462 precedent (behaviour change, shipped in a minor, not backported).
Claude Code on behalf of oscerd