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

   Thanks Claus, and thanks for settling the open question. I took it out of 
the description and kept the reasoning under "Not changed".
   
   Map body: applied. createInstance and updateInstance now convert a `Map` 
with `ObjectMapper.convertValue` (the new `readRequestBody` in `DMSProducer`), 
so the JSON unmarshalled by an earlier step works, with the same field names as 
the text. One nuance: updateInstance did not ignore a Map before, it failed 
like any other body that was not a String; both operations now accept it. A Map 
that does not fit the request fails like the text. `convertValue` puts the 
message of Jackson, with the value, into its `IllegalArgumentException`, so 
only its cause is used, to name the field. The body types list the `map` 
carrier, and the doc and the upgrade-guide entry mention the Map. Tests in 
`InstanceRequestBodyTest`: `createInstanceReadsMap`, `updateInstanceReadsMap`, 
`createInstanceFailsOnMapWithUnknownField` and 
`createInstanceFailureNamesTheFieldWithAWrongValueInMap`.
   
   Field path: applied. `jsonErrorDetail` now builds the path from 
`JsonMappingException.getPath()`, with the field names and array indexes only, 
so a wrong type reads "wrong value for field storage_space" with the line and 
column, or `available_zones[1]` for an element of an array. It still does not 
use the message of Jackson, which for a wrong type is `Cannot deserialize value 
of type Integer from String "<the value>"`. A Map has no location, so its 
detail has the field only. The new tests 
`createInstanceFailureNamesTheFieldWithAWrongValue`, 
`createInstanceFailureNamesTheArrayElementWithAWrongValue` and 
`updateInstanceFailureNamesTheFieldWithAWrongValue` check that the field is 
named and that the value is not in the message.
   
   _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