Skip to content
module@warp-drive/schema-dsl

Decorator array() ​

ts
function array(target: object, key: string): void;
function array(options: ArrayFieldOptions): (target: object, key: string) => void;

Call Signature ​

sincev5.9.0
ts
function array(target: object, key: string): void;

Defined in: fields/array.ts:64

Decorator

Marks a property as an ArrayField — an array of primitive values. For arrays of well-defined objects, use schemaArray.

Parameters ​

target ​

object

key ​

string

Returns ​

void

Example ​

ts
import { Resource, field, array } from '@warp-drive/schema-dsl';

@Resource
export class Post {
  @field declare title: string;
  @array declare tags: string[];
}
json
[
  { "kind": "array", "name": "tags" }
]

Call Signature ​

sincev5.9.0
ts
function array(options: ArrayFieldOptions): (target: object, key: string) => void;

Defined in: fields/array.ts:65

Decorator

Marks a property as an ArrayField — an array of primitive values. For arrays of well-defined objects, use schemaArray.

Parameters ​

options ​

ArrayFieldOptions

Returns ​

(target: object, key: string) => void

Example ​

ts
import { Resource, field, array } from '@warp-drive/schema-dsl';

@Resource
export class Post {
  @field declare title: string;
  @array declare tags: string[];
}
json
[
  { "kind": "array", "name": "tags" }
]

Released under the MIT License.