Skip to content

Commit 48d29ae

Browse files
committed
Add minLenght and maxLenght support to TextArea
Add minLenght and maxLenght support to TextArea
1 parent 91ae4b1 commit 48d29ae

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

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

1616
String description() default "";
1717

18+
int minLenght() default 0;
19+
20+
int maxLenght() default Integer.MAX_VALUE;
21+
1822
String fieldAddonLeft() default"";
1923

2024
String fieldAddonRight() default"";

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

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

1926
@Override

0 commit comments

Comments
 (0)