Skip to content

Record deserialization fails when there are custom constructors - #1168

Draft
radovanradic wants to merge 4 commits into
2.15.xfrom
record-multiconstructor-deser
Draft

Record deserialization fails when there are custom constructors#1168
radovanradic wants to merge 4 commits into
2.15.xfrom
record-multiconstructor-deser

Conversation

@radovanradic

@radovanradic radovanradic commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

It fails when micronaut.serde.deserialization.ignore-unknown=false and throws unknown property theDate and when ignore-unknown=true it does not fail but picks wrong constructor and does not deserialize as expected


@Serdeable
record MyRecord(String fooBar, int abcXyz, @Nullable Date theDate, @Nullable String otherStr) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding @JsonCreator here resolves the issue btw.

@dstepanov

Copy link
Copy Markdown
Contributor

I think this needs to be fixed in core

@graemerocher

Copy link
Copy Markdown
Contributor

@dstepanov can you look at it? Seems like a bug to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants