Skip to content

Fix: 5078 Add new MonthDeserializer #5122

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

Merged
merged 6 commits into from
Apr 26, 2025

Conversation

JooHyukKim
Copy link
Member

this part of #5078

Comment on lines 180 to 186
// TODO : Figure out how to make this pass.
// try {
// Month result = mapper.readerFor(Month.class).readValue("\"\"");
// fail("Should not pass");
// } catch (MismatchedInputException e) {
// verifyException(e, "Cannot coerce empty String");
// }
Copy link
Member Author

Choose a reason for hiding this comment

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

Current implementation returns null with or without below CoercionSetting 🤔.

Copy link
Member Author

Choose a reason for hiding this comment

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

This may be way to go as MonthDayDeser... also behaves the same

Copy link
Member

Choose a reason for hiding this comment

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

I figured it out -- is bit complicated but rules changed when LogicalType became DateTime instead of Enum (technically is an Enum but logically DateTime (more refined)).

So I changed test a bit.

@@ -17,9 +12,7 @@ public JavaTimeDeserializerModifier() { }
@Override
public ValueDeserializer<?> modifyEnumDeserializer(DeserializationConfig config, JavaType type,
BeanDescription.Supplier beanDescRef, ValueDeserializer<?> defaultDeserializer) {
if (type.hasRawClass(Month.class)) {
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this class altogether (I'll do that)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanksss I was actually 50/50 on this 😅 forgot to mention.

Copy link
Member

@cowtowncoder cowtowncoder left a comment

Choose a reason for hiding this comment

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

LGTM!

@cowtowncoder cowtowncoder merged commit c59c261 into FasterXML:3.x Apr 26, 2025
4 checks passed
@cowtowncoder
Copy link
Member

Excellent, thank you @JooHyukKim !

@JooHyukKim JooHyukKim deleted the fx-5078-MonthDeserializer branch April 27, 2025 03:48
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.

2 participants