Skip to content
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

Controller parameter binding into class annotated with Lombok NoArgsConstructor broken in 4.7.4 #11505

Closed
mattlong-finocomp opened this issue Jan 15, 2025 · 0 comments
Assignees
Labels
status: pr submitted A pull request has been submitted for the issue type: bug Something isn't working

Comments

@mattlong-finocomp
Copy link

Expected Behavior

I have a simple POJO object to deserialize a basic request body into.
I'm using Micronaut Serialization with json-p / json-b.
This object is annotated with the following lombok annotations:

  • Introspected
  • Data
  • Builder
  • NoArgsConstructor
  • AllArgsConstructor

I've configured the package that these classes are in to be in the micronaut.serde.included-introspection-packages list along with io.micronaut.

When posting to the an endpoint with a valid request body that matches the format of the POJO, then the controller should be able to bind this request body to my POJO when these lombok annotations are present.

This worked in Micronaut 4.7.3 and I suspect was broken with this change: #11481

There is a test for this combination of annotations in that pull request, but i wonder whether this issue might be unique to micronaut-serialization using json-p / json-b?

Actual Behaviour

The request gets a bad request response with the following body:
{"_links":{"self":[{"href":"/foo/bar","templated":false}]},"_embedded":{"errors":[{"message":"Failed to convert argument [barCommand] for value [null] due to: Error deserializing type: BarCommand barCommand","path":"/barCommand"}]},"message":"Bad Request"}

Steps To Reproduce

Run NoArgsConstructorLombokSpec in linked example application repo.
There's a test for a POJO without the NoArgsConstructor annotation which works, and one with it that breaks and logs the response body.

Environment Information

OS: Linux
JDK: 17

Example Application

https://github.com/mattlong-finocomp/mn-no-args-constructor-lombok

Version

4.7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pr submitted A pull request has been submitted for the issue type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants