Skip to content

Commit 5cd1db5

Browse files
authored
Merge pull request #160 from workfloworchestrator/2076-unregsiter-true
2076 unregsiter true
2 parents 20ce7fb + 7bcb18e commit 5cd1db5

File tree

9 files changed

+119
-451
lines changed

9 files changed

+119
-451
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pydantic-forms': minor
3+
---
4+
5+
Removes some unused functionality. Introduces shouldRegister=true to react-hook-form creation.

frontend/packages/pydantic-forms/src/components/zodValidationsPresets.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,16 @@ export const zodValidationPresets: PydanticFormZodValidationPresets = {
1818

1919
let validationRule = z.string().trim();
2020
if (minLength) {
21-
validationRule = validationRule?.min(
22-
minLength,
23-
minLength === 1
24-
? 'Moet ingevuld zijn'
25-
: `Dit veld heeft een minimum lengte van ${minLength} karakters`,
26-
);
21+
validationRule = validationRule?.min(minLength);
2722
}
2823

2924
if (maxLength) {
30-
validationRule = validationRule?.max(
31-
maxLength,
32-
`Dit veld heeft een maximum lengte van ${maxLength} karakters`,
33-
);
25+
validationRule = validationRule?.max(maxLength);
3426
}
3527

3628
if (pattern) {
3729
try {
38-
validationRule = validationRule?.regex(
39-
new RegExp(pattern),
40-
`De invoer is niet volgens het juiste formaat: ${pattern}`,
41-
);
30+
validationRule = validationRule?.regex(new RegExp(pattern));
4231
} catch (error) {
4332
console.error(
4433
'Could not parse validation rule regex',

0 commit comments

Comments
 (0)