Schemas are app-scoped. Use
client.forApp('my-app').schemas to access them.Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Define and manage event schemas
client.forApp('my-app').schemas to access them.const schemas = await appRes.schemas.list();
const schema = await appRes.schemas.getByEventName('order.placed');
const schema = await appRes.schemas.create({
eventName: 'order.placed',
description: 'Emitted when a checkout completes',
fields: [
{
id: 'fld-order-id',
name: 'orderId',
type: 'string',
required: true,
validation: { min: 1, max: 128 },
},
{
id: 'fld-amount',
name: 'amountCents',
type: 'number',
required: true,
},
{
id: 'fld-currency',
name: 'currency',
type: 'enum',
required: true,
enumValues: ['USD', 'EUR', 'GBP'],
},
{
id: 'fld-items',
name: 'itemCount',
type: 'number',
required: false,
defaultValue: 1,
},
],
metadataFields: [
{
id: 'meta-env',
name: 'environment',
type: 'string',
description: 'e.g. production, staging',
},
],
});
const updated = await appRes.schemas.update(schema.id, {
description: 'Updated description',
fields: [...],
});
| Type | Description | Validation options |
|---|---|---|
string | Text value | min, max (length), pattern (regex) |
number | Numeric value | min, max |
boolean | true or false | — |
date | ISO-8601 date string | — |
enum | Fixed set of strings | Provide enumValues array |
object | Nested JSON object | — |
interface SchemaField {
id: string;
name: string;
type: 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'object';
required: boolean;
defaultValue?: unknown;
description?: string;
enumValues?: string[];
validation?: {
min?: number;
max?: number;
pattern?: string;
};
}
vela push.