Skip to content

Commit 6e954a3

Browse files
committed
feat: add regex annotation support for schema properties
1 parent f23bc8c commit 6e954a3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/dogs_core/lib/src/schema/contributors.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ class StringValidationContributor
4141
)
4242
]);
4343
}
44+
45+
final pattern = target[SchemaProperties.pattern];
46+
if (pattern != null && pattern is String) {
47+
field = field.copy(annotations: [
48+
...field.annotations,
49+
Regex(pattern),
50+
]);
51+
}
52+
4453
return field;
4554
}
4655
}

0 commit comments

Comments
 (0)