One field in my domain object is defined as Long
Long balance
When we I use @RequestBody annotation, looks like it does map the http request body to my domain object but enabling a default deserialization that enforces Long type casting.
For example:
When consumer submits a balance value as 5.12, the balance value after deserialization will be only 5. Questions:
(1) From best practices perspective, do we throw back 400 Bad Request since the request is not as defined or just do such type casting and proceed?
(2) If we do wanna throw back 400, how do we do that since the casting logic is default by @RequestBody? Should we do an overriding and have a customized deserializer?
Thx.