Skip to content

Commit

Permalink
add base64url action's API reference
Browse files Browse the repository at this point in the history
  • Loading branch information
EltonLobo07 committed Feb 12, 2025
1 parent 4332795 commit e551b96
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 0 deletions.
66 changes: 66 additions & 0 deletions website/src/routes/api/(actions)/base64url/index.mdx
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']} />
58 changes: 58 additions & 0 deletions website/src/routes/api/(actions)/base64url/properties.ts
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',
},
],
},
},
};
27 changes: 27 additions & 0 deletions website/src/routes/api/(types)/Base64urlAction/index.mdx
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 website/src/routes/api/(types)/Base64urlAction/properties.ts
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',
},
},
};
26 changes: 26 additions & 0 deletions website/src/routes/api/(types)/Base64urlIssue/index.mdx
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 website/src/routes/api/(types)/Base64urlIssue/properties.ts
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',
},
},
};
3 changes: 3 additions & 0 deletions website/src/routes/api/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

- [args](/api/args/)
- [base64](/api/base64/)
- [base64url](/api/base64url/)
- [bic](/api/bic/)
- [brand](/api/brand/)
- [bytes](/api/bytes/)
Expand Down Expand Up @@ -258,6 +259,8 @@
- [AwaitActionAsync](/api/AwaitActionAsync/)
- [Base64Action](/api/Base64Action/)
- [Base64Issue](/api/Base64Issue/)
- [Base64urlAction](/api/Base64urlAction/)
- [Base64urlIssue](/api/Base64urlIssue/)
- [BaseIssue](/api/BaseIssue/)
- [BaseMetadata](/api/BaseMetadata/)
- [BaseSchema](/api/BaseSchema/)
Expand Down

0 comments on commit e551b96

Please sign in to comment.