oscerd commented on PR #28973:
URL: https://github.com/apache/camel/pull/28973#issuecomment-6588496564

   Thanks Claus, you are right about `arbitraryPayload`. With the previous 
commit, a DOM `Document` was stored as the quoted JSON string 
`"<user>admin</user>"`, a `ByteBuffer` as Base64 (`"czNjcjN0"`) and a `UUID` 
with quotes, where the type converter gives the XML, the text and the plain 
UUID. `isText` now also covers `Node`, `Source`, `ByteBuffer` and `UUID`, so 
these bodies are read with the type converter as before this PR. New tests: 
`createArbitrarySecretReadsADomDocumentAndASourceAsXml` (a `Document` and a 
`DOMSource`), `createArbitrarySecretReadsAByteBufferAsText` and 
`createArbitrarySecretReadsAUuidAsText`. All three fail without the change. The 
upgrade-guide entry now lists XML, a `ByteBuffer` and a `UUID` with the bodies 
stored as text, and the component doc and the body types description mention 
XML (the doc also the `ByteBuffer`).
   
   Agreed on `kvData`. It now tries `getBody(Map.class)` first and parses the 
body as JSON text only when that gives no Map. 
`createKVSecretTakesABodyThatConvertsToAMap` registers a type converter to Map 
for a test type and fails without the change.
   
   Added the null check before the `switch` in `updateSecret`; a missing type 
now fails with "The secret has no secret type. The updateSecret operation 
supports arbitrary and kv secrets.". One note while checking it: the IBM SDK 
never returns a `Secret` with a null type. A response without `secret_type`, or 
with `"secret_type": null`, already fails in the SDK with 
`InvalidServiceResponseException` ("Required discriminator property 
'secret_type' not found in JSON object"); I tried both against the test server. 
So the check is defensive and has no test through the SDK. I also corrected the 
PR description, which said the same NPE was reachable in getSecret.
   
   _Claude Code on behalf of Andrea Cosentino (oscerd)_
   


-- 
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