-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST of empty LocalDateTime value causes "Failed to convert argument" JSON response #11213
Comments
You marked field ts not null. That's why you have exception |
@altro3 no, even without the |
Try combination of Micronaut Nullable and NotNull from the validation |
@dstepanov that does not work either. Which is good as the String property works fine without It appears that the problem is a request with an empty value: More experimentation and I would argue though that form fields that are left blank should be interpreted as undefined ie NULL |
I think we should do that. |
Expected Behavior
When posted form values are missing a value for what on the server is a LocalDateTime a NULL value should be used and the controller action should be called for the mapped url.
Actual Behaviour
The mapped controller action is never called but Micronaut will respond with HTTP 400 Bad Request and a JSON body (even when the request has an Accept header without JSON match, but that is not the main issue)
Steps To Reproduce
Given the following code:
HTTP request with both values:
--> 👍 HTTP 202 (Accepted)
HTTP request with missing text value
--> 👍 HTTP 422 (Unprocessable Entity)
as expected the controller action is called and the
verify
method throws a ConstraintViolationException because of the missing valueHTTP request with missing date-time value
--> 👎 HTTP 400 (Bad Request) "Failed to convert argument [bean] for value [null] due to: Error deserializing type: TestBean bean"
the controller action is never called and therefore cannot provide the response expected by the frontend
Environment Information
MacOS 14.4.1
Temurin SDK 21.0.2
Micronaut 4.6.1 (can't use 4.6.2 because of micronaut-projects/micronaut-security#1808 )
Example Application
No response
Version
4.6.1
The text was updated successfully, but these errors were encountered: