Skip to content

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

Function: PortArrayObject()

PortArrayObject<T>(schema, config?): PropertyDecorator

Defined in: packages/chaingraph-types/src/decorator/array.decorator.ts:122

Helper decorator for an array port where each element is an object.

This decorator presets the item configuration for the port to { type: 'object', schema: providedSchema }. The caller must supply the object schema (as an explicit schema object or via a class decorated with @ObjectSchema).

Usage example: @PortArrayObject(MyObjectSchema, { defaultValue: [new MyObject()] }) public objects!: MyObject[];

Type Parameters

T

T extends ObjectPortSchemaInput

Parameters

schema

T

The schema used to configure each object element.

config?

Omit<Omit<ArrayPortConfig<any>, "itemConfig"> & object, "type" | "itemConfig">

Optional additional configuration for the array port.

Returns

PropertyDecorator

Licensed under BUSL-1.1