-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #415 from ariskemper/docs-octal-validation
docs: octal validation
- Loading branch information
Showing
6 changed files
with
131 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: OctalValidation | ||
description: Octal validation type. | ||
contributors: | ||
- fabian-hiller | ||
--- | ||
|
||
import { Property } from '~/components'; | ||
import { properties } from './properties'; | ||
|
||
# OctalValidation | ||
|
||
Octal validation type. | ||
|
||
## Generics | ||
|
||
- `TInput` <Property {...properties.TInput} /> | ||
|
||
## Definition | ||
|
||
- `OctalValidation` <Property {...properties.BaseValidation} /> | ||
- `type` <Property {...properties.type} /> | ||
- `requirement` <Property {...properties.requirement} /> |
33 changes: 33 additions & 0 deletions
33
website/src/routes/api/(types)/OctalValidation/properties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { PropertyProps } from '~/components'; | ||
|
||
export const properties: Record<string, PropertyProps> = { | ||
TInput: { | ||
modifier: 'extends', | ||
type: 'string', | ||
}, | ||
BaseValidation: { | ||
type: { | ||
type: 'custom', | ||
name: 'BaseValidation', | ||
href: '../BaseValidation/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
], | ||
}, | ||
}, | ||
type: { | ||
type: { | ||
type: 'string', | ||
value: 'octal', | ||
}, | ||
}, | ||
requirement: { | ||
type: { | ||
type: 'custom', | ||
name: 'RegExp', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,55 @@ | ||
--- | ||
title: octal | ||
description: Creates a pipeline validation action that validates an octal. | ||
source: /validations/octal/octal.ts | ||
contributors: | ||
- fabian-hiller | ||
- ariskemper | ||
--- | ||
|
||
import { ApiList, Property } from '~/components'; | ||
import { properties } from './properties'; | ||
|
||
# octal | ||
|
||
> The content of this page is not yet ready. Until then, please use the [source code](https://github.com/fabian-hiller/valibot/blob/main/library/src/validations/octal/octal.ts) or take a look at [issue #287](https://github.com/fabian-hiller/valibot/issues/287) to help us extend the API reference. | ||
Creates a pipeline validation action that validates an [octal](https://en.wikipedia.org/wiki/Octal). | ||
|
||
```ts | ||
const validation = octal<TInput>(message); | ||
``` | ||
|
||
## Generics | ||
|
||
- `TInput` <Property {...properties.TInput} /> | ||
|
||
## Parameters | ||
|
||
- `message` <Property {...properties.message} /> | ||
|
||
### Explanation | ||
|
||
With `octal` you can validate the formatting of a string. If the input is not an octal, you can use `message` to customize the error message. | ||
|
||
## Returns | ||
|
||
- `validation` <Property {...properties.validation} /> | ||
|
||
## Examples | ||
|
||
The following examples show how `octal` can be used. | ||
|
||
### Octal schema | ||
|
||
Schema to validate a octal string. | ||
|
||
```ts | ||
const OctalSchema = string([octal('The octal is badly formatted.')]); | ||
``` | ||
|
||
## Related | ||
|
||
The following APIs can be combined with `octal`. | ||
|
||
### Schemas | ||
|
||
<ApiList items={['any', 'string', 'unknown']} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { PropertyProps } from '~/components'; | ||
|
||
export const properties: Record<string, PropertyProps> = { | ||
TInput: { | ||
modifier: 'extends', | ||
type: 'string', | ||
}, | ||
message: { | ||
type: { | ||
type: 'union', | ||
options: [ | ||
{ | ||
type: 'custom', | ||
name: 'ErrorMessage', | ||
href: '../ErrorMessage/', | ||
}, | ||
'undefined', | ||
], | ||
}, | ||
}, | ||
validation: { | ||
type: { | ||
type: 'custom', | ||
name: 'OctalValidation', | ||
href: '../OctalValidation/', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters