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
Allow DurationFormat and PeriodFormat to be used on parameters #22646
Conversation
assertThat(bean.getFormattedDuration()).isEqualTo(Duration.ofDays(15)); | ||
assertThat(bean.getFormattedPeriod()).isEqualTo(Period.ofYears(16)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These assertions succeed without @DurationFormat
and @PeriodFormat
on ConstructorParameterWithUnitProperties
. I think that's because the converter successfully infers the style to use from the value that's being converted. To verify that the format annotations are working as expected, I think it would be necessary to trigger a failure by trying, for example, to bind an ISO-8601 value to a property that requires the simple style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I extended/reworked the testing a bit. Let me know if this is what you had in mind, @wilkinsona
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spot on. Thanks.
Hi,
this PR should close #22644 .
Cheers,
Christoph