Closed asashour closed 3 months ago
When an object has a property marked as @Size(min=2) for example, it is expected that that field is shown are required.
@Size(min=2)
This also applies for Java primitive types.
For example:
import jakarta.validation.constraints.*; @RestController @RequestMapping("something") public class TestController { @PostMapping SomeObject test(@RequestBody @Valid SomeObject object) { return null; } private record SomeObject( @Size(min = 2) String name, boolean flag, @NotNull String sting) { } }
Expectation: name, flag and string are all required.
name
flag
string
Actual result: Only string is marked as required
required
@asashour,
The Size constraint min=2, is higher than required, and this is what is considered. Nothing else is planned for this case.
Size
min=2
When an object has a property marked as
@Size(min=2)
for example, it is expected that that field is shown are required.This also applies for Java primitive types.
For example:
Expectation:
name
,flag
andstring
are all required.Actual result: Only
string
is marked asrequired