micronaut-projects / micronaut-projects/micronaut-validation

bug: props with optional getters should be validated

Open
#281 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Java
Stars
9
Forks
8
Avg merge
20h 7m
Merged PRs (30d)
9

Description

Previously in 3.x a class with optional getters was still validated.

This reproducer tests this case, and shows that it currently fails to validate.

If you remove the getter from the POGO, then the test passes.

This was discovered in building the hibernate-reactive guide where we have the following validated DTO:

https://github.com/micronaut-projects/micronaut-guides/blob/ab0bfb2c117de73b24aabbb9422ec58dadaebb8d/guides/micronaut-hibernate-reactive/java/src/main/java/example/micronaut/SortingAndOrderArguments.java

There's a reproducer here: https://github.com/micronaut-projects/micronaut-validation/pull/165

Contributor guide

Open the contributing guide

Research direction

Start with the reproducer in pull request #165 and the validated DTO at guides/micronaut-hibernate-reactive/java/src/main/java/example/micronaut/SortingAndOrderArguments.java. Compare behavior with and without the optional getter, using the prior 3.x behavior as the reference. Done means the DTO with optional getters is validated again.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.