---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/extension/interfaces/WireSchema.md
---
[Reference](../../../../index.md) / [@getenginex/sdk/extension](../index.md) / WireSchema

# WireSchema\<TWire, TMessage>

Schema of a realtime message: a Zod schema (usually `wire({...})`) that takes the
wire payload (`TWire`, `snake_case`) and returns the public message (`TMessage`, `camelCase`).
Typed structurally, so that Zod types do not appear in the realtime API: it requires Zod's
`safeParse`, which realtime uses to validate in the client's mode (`warn` recovers field by
field, as in HTTP responses). A schema that is only [Standard Schema](https://standardschema.dev) (e.g.
Valibot) will not do.

## Type Parameters

### TWire

`TWire`

### TMessage

`TMessage`

## Properties

### ~standard

> `readonly` **~standard**: `object`

Standard Schema metadata (only the types are read, to infer `TWire`).

#### types?

> `readonly` `optional` **types?**: `object`

Input (wire) and output (public message) types.

##### types.input

> `readonly` **input**: `TWire`

##### types.output

> `readonly` **output**: `TMessage`

#### vendor

> `readonly` **vendor**: `string`

Schema library (Zod).

#### version

> `readonly` **version**: `1`

Version of the Standard Schema interface.

## Methods

### safeParse()

> **safeParse**(`data`): { `data`: `TMessage`; `success`: `true`; } | { `error`: `unknown`; `success`: `false`; }

Validates and converts a value (Zod's `safeParse`).

#### Parameters

##### data

`unknown`

Payload received from the gateway.

#### Returns

{ `data`: `TMessage`; `success`: `true`; } | { `error`: `unknown`; `success`: `false`; }
