Skip to content

Commit

Permalink
Added more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ozziest committed Dec 16, 2023
1 parent feec0cf commit 071caf4
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default defineConfig({
],
},
{
text: "Rules",
text: "Reference",
items: [
{ text: "Why?", link: "/xx" },
{ text: "Getting started", link: "/rr" },
{ text: "Rules", link: "/rules" },
{ text: "i18n", link: "/rr" },
],
},
],
Expand Down
71 changes: 71 additions & 0 deletions docs/rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Rules

In this section, you can find the truth tables for all validation rules.

:::tip
You can learn more about the [Rule Terminology](/terminology.html#rule).
:::

## `accepted`

The field under validation must be `yes`, `on`, `1` or `true`. This is useful for validating "Terms of Service" acceptance.

| Definition | Value | Is valid? |
| ---------- | ----------- | --------- |
| `accepted` | `null` | 🟒 |
| `accepted` | `undefined` | 🟒 |
| `accepted` | `'yes'` | 🟒 |
| `accepted` | `'on'` | 🟒 |
| `accepted` | `1` | 🟒 |
| `accepted` | `true` | 🟒 |
| `accepted` | `john` | πŸ”΄ |
| `accepted` | `3.14` | πŸ”΄ |

## `after:date`

The field under validation must be after the given date.

| Definition | Value | Is valid? |
| ------------------ | ------------ | --------- |
| `after:2024-01-01` | `null` | 🟒 |
| `after:2024-01-01` | `undefined` | 🟒 |
| `after:2024-01-01` | `2025-01-01` | 🟒 |
| `after:2024-01-01` | `2024-01-01` | πŸ”΄ |
| `after:2024-01-01` | `2020-01-01` | πŸ”΄ |

## `afterOrEqual:date`

The field unter validation must be after or equal to the given field

| Definition | Value | Is valid? |
| ------------------ | ------------ | --------- |
| `after:2024-01-01` | `null` | 🟒 |
| `after:2024-01-01` | `undefined` | 🟒 |
| `after:2024-01-01` | `2025-01-01` | 🟒 |
| `after:2024-01-01` | `2024-01-01` | 🟒 |
| `after:2024-01-01` | `2020-01-01` | πŸ”΄ |

## `alpha`

The field under validation must be entirely alphabetic characters.

| Definition | Value | Is valid? |
| ---------- | ----------- | --------- |
| `alpha` | `null` | 🟒 |
| `alpha` | `undefined` | 🟒 |
| `alpha` | `john` | 🟒 |
| `alpha` | `123` | πŸ”΄ |
| `alpha` | `3.14` | πŸ”΄ |
| `alpha` | `true` | πŸ”΄ |

## `required`

| Definition | Value | Is valid? |
| ---------- | ----------- | --------- |
| `required` | `null` | πŸ”΄ |
| `required` | `undefined` | πŸ”΄ |
| `required` | `''` | πŸ”΄ |
| `required` | `john` | 🟒 |
| `required` | `123` | 🟒 |
| `required` | `1.23` | 🟒 |
| `required` | `{}` | 🟒 |

0 comments on commit 071caf4

Please sign in to comment.