Skip to content

Conversation

@cowtowncoder
Copy link
Member

@cowtowncoder cowtowncoder commented Nov 20, 2025

Fixes #5398

@cowtowncoder cowtowncoder self-assigned this Nov 20, 2025
@cowtowncoder cowtowncoder added the gen-ai PR created with Generative AI (whole or assisted) (or issue for which gen-ai seems suitable) label Nov 20, 2025
@cowtowncoder cowtowncoder merged commit 1fe6ee7 into 2.x Nov 20, 2025
6 checks passed
@cowtowncoder cowtowncoder deleted the claude/2.x/5398-ignoral-with-renaming branch November 20, 2025 01:11
@cowtowncoder cowtowncoder added this to the 2.21.0 milestone Nov 20, 2025
Test5398 result = MAPPER.readValue(json, Test5398.class);
assertNotNull(result);
// Since setter is ignored, the deserialized object should have the default value
assertEquals("someValue", result.getProp());
Copy link
Contributor

Choose a reason for hiding this comment

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

@cowtowncoder just a nitpick but here I think the test is too ambiguous, it would have been better to set original's prop to a different value than the default one, to validate that it's indeed the default value that is used and not the one coming from json.

I can submit a PR if you want :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ha! I tried and actually the comment

// Since setter is ignored, the deserialized object should have the default value

Is incorrect, if I remove the default value from the class and set it manually just before calling writeValueAsString, then result.getProp() has the value "someValue".

I tested on 2.17 too and it was like that also.

Copy link
Contributor

@victornoel victornoel Nov 20, 2025

Choose a reason for hiding this comment

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

And this behaviour is actually consistent with when we don't rename the prop (cf my examples in #5398 (comment)). I proposed an improvement of this test here: #5412

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

Labels

gen-ai PR created with Generative AI (whole or assisted) (or issue for which gen-ai seems suitable)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants