Skip to content

ChainGraph API Documentation / @badaitech/chaingraph-types / createObjectSchema

Function: createObjectSchema()

createObjectSchema<T>(properties): IObjectSchema<T>

Defined in: packages/chaingraph-types/src/port/instances/ObjectPort.ts:365

Helper to create an ObjectSchema.

This function infers the schema type from the provided properties, so that nested port configuration types are known.

Example: const userSchema = createObjectSchema({ name: { type: 'string', minLength: 2 }, age: { type: 'number', min: 21 } })

Type Parameters

T

T extends Record<string, IPortConfig>

Parameters

properties

T

A mapping of property keys to their port configurations.

Returns

IObjectSchema<T>

An ObjectSchema with the inferred property types.

Licensed under BUSL-1.1