Skip to content

Commit e551b96

Browse files
committed
add base64url action's API reference
1 parent 4332795 commit e551b96

File tree

7 files changed

+332
-0
lines changed

7 files changed

+332
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: base64url
3+
description: Creates a base64url validation action.
4+
source: /actions/base64url/base64url.ts
5+
contributors:
6+
- EltonLobo07
7+
---
8+
9+
import { ApiList, Property } from '~/components';
10+
import { properties } from './properties';
11+
12+
# base64url
13+
14+
Creates a [base64url](https://datatracker.ietf.org/doc/html/rfc4648#section-5) validation action.
15+
16+
```ts
17+
const Action = v.base64url<TInput, TMessage>(message);
18+
```
19+
20+
## Generics
21+
22+
- `TInput` <Property {...properties.TInput} />
23+
- `TMessage` <Property {...properties.TMessage} />
24+
25+
## Parameters
26+
27+
- `message` <Property {...properties.message} />
28+
29+
### Explanation
30+
31+
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.
32+
33+
## Returns
34+
35+
- `Action` <Property {...properties.Action} />
36+
37+
## Examples
38+
39+
The following examples show how `base64url` can be used.
40+
41+
### Base64url schema
42+
43+
Schema to validate a Base64url string.
44+
45+
```ts
46+
const Base64urlSchema = v.pipe(
47+
v.string(),
48+
v.base64url('The data is badly encoded.')
49+
);
50+
```
51+
52+
## Related
53+
54+
The following APIs can be combined with `base64url`.
55+
56+
### Schemas
57+
58+
<ApiList items={['any', 'custom', 'string', 'unknown']} />
59+
60+
### Methods
61+
62+
<ApiList items={['pipe']} />
63+
64+
### Utils
65+
66+
<ApiList items={['isOfKind', 'isOfType']} />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import type { PropertyProps } from '~/components';
2+
3+
export const properties: Record<string, PropertyProps> = {
4+
TInput: {
5+
modifier: 'extends',
6+
type: 'string',
7+
},
8+
TMessage: {
9+
modifier: 'extends',
10+
type: {
11+
type: 'union',
12+
options: [
13+
{
14+
type: 'custom',
15+
name: 'ErrorMessage',
16+
href: '../ErrorMessage/',
17+
generics: [
18+
{
19+
type: 'custom',
20+
name: 'Base64urlIssue',
21+
href: '../Base64urlIssue/',
22+
generics: [
23+
{
24+
type: 'custom',
25+
name: 'TInput',
26+
},
27+
],
28+
},
29+
],
30+
},
31+
'undefined',
32+
],
33+
},
34+
},
35+
message: {
36+
type: {
37+
type: 'custom',
38+
name: 'TMessage',
39+
},
40+
},
41+
Action: {
42+
type: {
43+
type: 'custom',
44+
name: 'Base64urlAction',
45+
href: '../Base64urlAction/',
46+
generics: [
47+
{
48+
type: 'custom',
49+
name: 'TInput',
50+
},
51+
{
52+
type: 'custom',
53+
name: 'TMessage',
54+
},
55+
],
56+
},
57+
},
58+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Base64urlAction
3+
description: Base64url action interface.
4+
contributors:
5+
- EltonLobo07
6+
---
7+
8+
import { Property } from '~/components';
9+
import { properties } from './properties';
10+
11+
# Base64urlAction
12+
13+
Base64url action interface.
14+
15+
## Generics
16+
17+
- `TInput` <Property {...properties.TInput} />
18+
- `TMessage` <Property {...properties.TMessage} />
19+
20+
## Definition
21+
22+
- `Base64urlAction` <Property {...properties.BaseValidation} />
23+
- `type` <Property {...properties.type} />
24+
- `reference` <Property {...properties.reference} />
25+
- `expects` <Property {...properties.expects} />
26+
- `requirement` <Property {...properties.requirement} />
27+
- `message` <Property {...properties.message} />
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import type { PropertyProps } from '~/components';
2+
3+
export const properties: Record<string, PropertyProps> = {
4+
TInput: {
5+
modifier: 'extends',
6+
type: 'string',
7+
},
8+
TMessage: {
9+
modifier: 'extends',
10+
type: {
11+
type: 'union',
12+
options: [
13+
{
14+
type: 'custom',
15+
name: 'ErrorMessage',
16+
href: '../ErrorMessage/',
17+
generics: [
18+
{
19+
type: 'custom',
20+
name: 'Base64urlIssue',
21+
href: '../Base64urlIssue/',
22+
generics: [
23+
{
24+
type: 'custom',
25+
name: 'TInput',
26+
},
27+
],
28+
},
29+
],
30+
},
31+
'undefined',
32+
],
33+
},
34+
},
35+
BaseValidation: {
36+
modifier: 'extends',
37+
type: {
38+
type: 'custom',
39+
name: 'BaseValidation',
40+
href: '../BaseValidation/',
41+
generics: [
42+
{
43+
type: 'custom',
44+
name: 'TInput',
45+
},
46+
{
47+
type: 'custom',
48+
name: 'TInput',
49+
},
50+
{
51+
type: 'custom',
52+
name: 'Base64urlIssue',
53+
href: '../Base64urlIssue/',
54+
generics: [
55+
{
56+
type: 'custom',
57+
name: 'TInput',
58+
},
59+
],
60+
},
61+
],
62+
},
63+
},
64+
type: {
65+
type: {
66+
type: 'string',
67+
value: 'base64url',
68+
},
69+
},
70+
reference: {
71+
type: {
72+
type: 'custom',
73+
modifier: 'typeof',
74+
name: 'base64url',
75+
href: '../base64url/',
76+
},
77+
},
78+
expects: {
79+
type: 'null',
80+
},
81+
requirement: {
82+
type: {
83+
type: 'custom',
84+
name: 'RegExp',
85+
},
86+
},
87+
message: {
88+
type: {
89+
type: 'custom',
90+
name: 'TMessage',
91+
},
92+
},
93+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Base64urlIssue
3+
description: Base64url issue interface.
4+
contributors:
5+
- EltonLobo07
6+
---
7+
8+
import { Property } from '~/components';
9+
import { properties } from './properties';
10+
11+
# Base64urlIssue
12+
13+
Base64url issue interface.
14+
15+
## Generics
16+
17+
- `TInput` <Property {...properties.TInput} />
18+
19+
## Definition
20+
21+
- `Base64urlIssue` <Property {...properties.BaseIssue} />
22+
- `kind` <Property {...properties.kind} />
23+
- `type` <Property {...properties.type} />
24+
- `expected` <Property {...properties.expected} />
25+
- `received` <Property {...properties.received} />
26+
- `requirement` <Property {...properties.requirement} />
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import type { PropertyProps } from '~/components';
2+
3+
export const properties: Record<string, PropertyProps> = {
4+
TInput: {
5+
modifier: 'extends',
6+
type: 'string',
7+
},
8+
BaseIssue: {
9+
modifier: 'extends',
10+
type: {
11+
type: 'custom',
12+
name: 'BaseIssue',
13+
href: '../BaseIssue/',
14+
generics: [
15+
{
16+
type: 'custom',
17+
name: 'TInput',
18+
},
19+
],
20+
},
21+
},
22+
kind: {
23+
type: {
24+
type: 'string',
25+
value: 'validation',
26+
},
27+
},
28+
type: {
29+
type: {
30+
type: 'string',
31+
value: 'base64url',
32+
},
33+
},
34+
expected: {
35+
type: 'null',
36+
},
37+
received: {
38+
type: {
39+
type: 'template',
40+
parts: [
41+
{
42+
type: 'string',
43+
value: '"',
44+
},
45+
'string',
46+
{
47+
type: 'string',
48+
value: '"',
49+
},
50+
],
51+
},
52+
},
53+
requirement: {
54+
type: {
55+
type: 'custom',
56+
name: 'RegExp',
57+
},
58+
},
59+
};

website/src/routes/api/menu.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777

7878
- [args](/api/args/)
7979
- [base64](/api/base64/)
80+
- [base64url](/api/base64url/)
8081
- [bic](/api/bic/)
8182
- [brand](/api/brand/)
8283
- [bytes](/api/bytes/)
@@ -258,6 +259,8 @@
258259
- [AwaitActionAsync](/api/AwaitActionAsync/)
259260
- [Base64Action](/api/Base64Action/)
260261
- [Base64Issue](/api/Base64Issue/)
262+
- [Base64urlAction](/api/Base64urlAction/)
263+
- [Base64urlIssue](/api/Base64urlIssue/)
261264
- [BaseIssue](/api/BaseIssue/)
262265
- [BaseMetadata](/api/BaseMetadata/)
263266
- [BaseSchema](/api/BaseSchema/)

0 commit comments

Comments
 (0)