Skip to content

Commit

Permalink
Improve code examples with new validation action
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-hiller committed May 25, 2024
1 parent b92d38c commit 110082a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion website/src/routes/api/(actions)/email/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Schema to validate an email.

```ts
const EmailSchema = string([
minLength(1, 'Please enter your email.'),
nonEmpty('Please enter your email.'),
email('The email is badly formatted.'),
maxLength(30, 'Your email is too long.'),
]);
Expand Down
2 changes: 1 addition & 1 deletion website/src/routes/api/(methods)/forward/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const PasswordSchema = v.pipe(
v.object({
password1: v.pipe(
v.string(),
v.minLength(1, 'Please enter your password.'),
v.nonEmpty('Please enter your password.'),
v.minLength(8, 'Your password must have 8 characters or more.')
),
password2: v.string(),
Expand Down
2 changes: 1 addition & 1 deletion website/src/routes/api/(schemas)/string/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Schema to validate an email.
```ts
const EmailSchema = v.pipe(
v.string(),
v.minLength(1, 'Please enter your email.'),
v.nonEmpty('Please enter your email.'),
v.email('The email is badly formatted.'),
v.maxLength(30, 'Your email is too long.')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ import * as m from './paraglide/messages.js';
const LoginSchema = v.object({
email: v.pipe(
v.string(),
v.minLength(1, m.emailRequired),
v.nonEmpty(m.emailRequired),
v.email(m.emailInvalid)
),
password: v.pipe(
v.string(),
v.minLength(1, m.passwordRequired),
v.nonEmpty(m.passwordRequired),
v.minLength(8, m.passwordInvalid)
),
});
Expand Down
4 changes: 2 additions & 2 deletions website/src/routes/guides/(get-started)/comparison/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import * as v from 'valibot'; // 1.07 kB
const LoginSchema = v.object({
email: v.pipe(
v.string(),
v.minLength(1, 'Please enter your email.'),
v.nonEmpty('Please enter your email.'),
v.email('The email address is badly formatted.')
),
password: v.pipe(
v.string(),
v.minLength(1, 'Please enter your password.'),
v.nonEmpty('Please enter your password.'),
v.minLength(8, 'Your password must have 8 characters or more.')
),
});
Expand Down
4 changes: 2 additions & 2 deletions website/src/routes/guides/(main-concepts)/methods/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ const RegisterSchema = v.pipe(
v.object({
email: v.pipe(
v.string(),
v.minLength(1, 'Please enter your email.'),
v.nonEmpty('Please enter your email.'),
v.email('The email address is badly formatted.')
),
password1: v.pipe(
v.string(),
v.minLength(1, 'Please enter your password.'),
v.nonEmpty('Please enter your password.'),
v.minLength(8, 'Your password must have 8 characters or more.')
),
password2: v.string(),
Expand Down
4 changes: 2 additions & 2 deletions website/src/routes/guides/(main-concepts)/schemas/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ import * as v from 'valibot';
const LoginSchema = v.object({
email: v.pipe(
v.string('Your email must be a string.'),
v.minLength(1, 'Please enter your email.'),
v.nonEmpty('Please enter your email.'),
v.email('The email address is badly formatted.')
),
password: v.pipe(
v.string('Your password must be a string.'),
v.minLength(1, 'Please enter your password.'),
v.nonEmpty('Please enter your password.'),
v.minLength(8, 'Your password must have 8 characters or more.')
),
});
Expand Down

0 comments on commit 110082a

Please sign in to comment.