-
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add
base64url
action's API reference
- Loading branch information
1 parent
4332795
commit e551b96
Showing
7 changed files
with
332 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: base64url | ||
description: Creates a base64url validation action. | ||
source: /actions/base64url/base64url.ts | ||
contributors: | ||
- EltonLobo07 | ||
--- | ||
|
||
import { ApiList, Property } from '~/components'; | ||
import { properties } from './properties'; | ||
|
||
# base64url | ||
|
||
Creates a [base64url](https://datatracker.ietf.org/doc/html/rfc4648#section-5) validation action. | ||
|
||
```ts | ||
const Action = v.base64url<TInput, TMessage>(message); | ||
``` | ||
|
||
## Generics | ||
|
||
- `TInput` <Property {...properties.TInput} /> | ||
- `TMessage` <Property {...properties.TMessage} /> | ||
|
||
## Parameters | ||
|
||
- `message` <Property {...properties.message} /> | ||
|
||
### Explanation | ||
|
||
With `base64url` you can validate the formatting of a string. If the input is not a Base64url string, you can use `message` to customize the error message. | ||
|
||
## Returns | ||
|
||
- `Action` <Property {...properties.Action} /> | ||
|
||
## Examples | ||
|
||
The following examples show how `base64url` can be used. | ||
|
||
### Base64url schema | ||
|
||
Schema to validate a Base64url string. | ||
|
||
```ts | ||
const Base64urlSchema = v.pipe( | ||
v.string(), | ||
v.base64url('The data is badly encoded.') | ||
); | ||
``` | ||
|
||
## Related | ||
|
||
The following APIs can be combined with `base64url`. | ||
|
||
### Schemas | ||
|
||
<ApiList items={['any', 'custom', 'string', 'unknown']} /> | ||
|
||
### Methods | ||
|
||
<ApiList items={['pipe']} /> | ||
|
||
### Utils | ||
|
||
<ApiList items={['isOfKind', 'isOfType']} /> |
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,58 @@ | ||
import type { PropertyProps } from '~/components'; | ||
|
||
export const properties: Record<string, PropertyProps> = { | ||
TInput: { | ||
modifier: 'extends', | ||
type: 'string', | ||
}, | ||
TMessage: { | ||
modifier: 'extends', | ||
type: { | ||
type: 'union', | ||
options: [ | ||
{ | ||
type: 'custom', | ||
name: 'ErrorMessage', | ||
href: '../ErrorMessage/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'Base64urlIssue', | ||
href: '../Base64urlIssue/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
'undefined', | ||
], | ||
}, | ||
}, | ||
message: { | ||
type: { | ||
type: 'custom', | ||
name: 'TMessage', | ||
}, | ||
}, | ||
Action: { | ||
type: { | ||
type: 'custom', | ||
name: 'Base64urlAction', | ||
href: '../Base64urlAction/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
{ | ||
type: 'custom', | ||
name: 'TMessage', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
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,27 @@ | ||
--- | ||
title: Base64urlAction | ||
description: Base64url action interface. | ||
contributors: | ||
- EltonLobo07 | ||
--- | ||
|
||
import { Property } from '~/components'; | ||
import { properties } from './properties'; | ||
|
||
# Base64urlAction | ||
|
||
Base64url action interface. | ||
|
||
## Generics | ||
|
||
- `TInput` <Property {...properties.TInput} /> | ||
- `TMessage` <Property {...properties.TMessage} /> | ||
|
||
## Definition | ||
|
||
- `Base64urlAction` <Property {...properties.BaseValidation} /> | ||
- `type` <Property {...properties.type} /> | ||
- `reference` <Property {...properties.reference} /> | ||
- `expects` <Property {...properties.expects} /> | ||
- `requirement` <Property {...properties.requirement} /> | ||
- `message` <Property {...properties.message} /> |
93 changes: 93 additions & 0 deletions
93
website/src/routes/api/(types)/Base64urlAction/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,93 @@ | ||
import type { PropertyProps } from '~/components'; | ||
|
||
export const properties: Record<string, PropertyProps> = { | ||
TInput: { | ||
modifier: 'extends', | ||
type: 'string', | ||
}, | ||
TMessage: { | ||
modifier: 'extends', | ||
type: { | ||
type: 'union', | ||
options: [ | ||
{ | ||
type: 'custom', | ||
name: 'ErrorMessage', | ||
href: '../ErrorMessage/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'Base64urlIssue', | ||
href: '../Base64urlIssue/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
'undefined', | ||
], | ||
}, | ||
}, | ||
BaseValidation: { | ||
modifier: 'extends', | ||
type: { | ||
type: 'custom', | ||
name: 'BaseValidation', | ||
href: '../BaseValidation/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
{ | ||
type: 'custom', | ||
name: 'Base64urlIssue', | ||
href: '../Base64urlIssue/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
type: { | ||
type: { | ||
type: 'string', | ||
value: 'base64url', | ||
}, | ||
}, | ||
reference: { | ||
type: { | ||
type: 'custom', | ||
modifier: 'typeof', | ||
name: 'base64url', | ||
href: '../base64url/', | ||
}, | ||
}, | ||
expects: { | ||
type: 'null', | ||
}, | ||
requirement: { | ||
type: { | ||
type: 'custom', | ||
name: 'RegExp', | ||
}, | ||
}, | ||
message: { | ||
type: { | ||
type: 'custom', | ||
name: 'TMessage', | ||
}, | ||
}, | ||
}; |
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,26 @@ | ||
--- | ||
title: Base64urlIssue | ||
description: Base64url issue interface. | ||
contributors: | ||
- EltonLobo07 | ||
--- | ||
|
||
import { Property } from '~/components'; | ||
import { properties } from './properties'; | ||
|
||
# Base64urlIssue | ||
|
||
Base64url issue interface. | ||
|
||
## Generics | ||
|
||
- `TInput` <Property {...properties.TInput} /> | ||
|
||
## Definition | ||
|
||
- `Base64urlIssue` <Property {...properties.BaseIssue} /> | ||
- `kind` <Property {...properties.kind} /> | ||
- `type` <Property {...properties.type} /> | ||
- `expected` <Property {...properties.expected} /> | ||
- `received` <Property {...properties.received} /> | ||
- `requirement` <Property {...properties.requirement} /> |
59 changes: 59 additions & 0 deletions
59
website/src/routes/api/(types)/Base64urlIssue/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,59 @@ | ||
import type { PropertyProps } from '~/components'; | ||
|
||
export const properties: Record<string, PropertyProps> = { | ||
TInput: { | ||
modifier: 'extends', | ||
type: 'string', | ||
}, | ||
BaseIssue: { | ||
modifier: 'extends', | ||
type: { | ||
type: 'custom', | ||
name: 'BaseIssue', | ||
href: '../BaseIssue/', | ||
generics: [ | ||
{ | ||
type: 'custom', | ||
name: 'TInput', | ||
}, | ||
], | ||
}, | ||
}, | ||
kind: { | ||
type: { | ||
type: 'string', | ||
value: 'validation', | ||
}, | ||
}, | ||
type: { | ||
type: { | ||
type: 'string', | ||
value: 'base64url', | ||
}, | ||
}, | ||
expected: { | ||
type: 'null', | ||
}, | ||
received: { | ||
type: { | ||
type: 'template', | ||
parts: [ | ||
{ | ||
type: 'string', | ||
value: '"', | ||
}, | ||
'string', | ||
{ | ||
type: 'string', | ||
value: '"', | ||
}, | ||
], | ||
}, | ||
}, | ||
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