Skip to content

Commit 49b34cf

Browse files
committed
Add Pattern , minLenght and maxLenght Password support
Add Pattern , minLenght and maxLenght Password support
1 parent fdab48e commit 49b34cf

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/io/asfjava/ui/core/form/Password.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515

1616
String description() default "";
1717

18+
int minLenght() default 0;
19+
20+
int maxLenght() default Integer.MAX_VALUE;
21+
22+
String pattern() default "";
23+
1824
String fieldAddonLeft() default"";
1925

2026
String fieldAddonRight() default"";

src/main/java/io/asfjava/ui/core/schema/decorators/PasswordSchemaDecorator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ public void customizeSchema(BeanProperty property, JsonSchema jsonschema) {
1414
if (annotation != null && annotation.title() != null) {
1515
((StringSchema) jsonschema).setTitle(annotation.title());
1616
}
17+
if (annotation.pattern() != null) {
18+
((StringSchema) jsonschema).setPattern(annotation.pattern());
19+
}
20+
if (annotation.minLenght() != 0) {
21+
((StringSchema) jsonschema).setMinLength(annotation.minLenght());
22+
}
23+
if (annotation.maxLenght() != Integer.MAX_VALUE) {
24+
((StringSchema) jsonschema).setMaxLength(annotation.maxLenght());
25+
}
1726
}
1827

1928
@Override

0 commit comments

Comments
 (0)