Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

Schema

interfaz

Public Standard Schema v1 contract for API, RPC, and Socket. Los schemas de Valibot lo implementan; los públicos viven en shared/.

ts
import type { Schema } from "@meekojs/meeko/server";

Source code src/server/schema.ts:16

Declaración #

ts
interface Schema<I = unknown, O = I> {
	readonly '~standard': {
		readonly version: 1
		readonly validate: (value: unknown) => { value: O; issues?: undefined } | { issues: readonly unknown[] } | Promise<{ value: O; issues?: undefined } | { issues: readonly unknown[] }>
		readonly types?: { readonly input: I; readonly output: O } | undefined
	}
}

Type parameters #

I = unknown

Tipo de entrada.

O = I

Tipo de salida, tras validar y transformar.

Example #

ts
// shared/schemas/user.ts
import * as v from "valibot";
import type { Schema } from "@meekojs/meeko/server";

export const userSchema: Schema<{ id: string; name: string }> = v.object({ id: v.string(), name: v.string() });

Propiedades #

~standard #

propiedad sólo lectura

readonly '~standard': {
	readonly version: 1
	readonly validate: (value: unknown) => { value: O; issues?: undefined } | { issues: readonly unknown[] } | Promise<{ value: O; issues?: undefined } | { issues: readonly unknown[] }>
	readonly types?: { readonly input: I; readonly output: O } | undefined
}

Interfaz Standard Schema v1: validate devuelve el valor de salida o la lista de issues.

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/server/schema.ts