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

Call Signature

ts
function object(target, key): void;

Defined in: fields/object.ts:61

Decorator

Marks a property as an ObjectField — an object whose keys point to primitive values with no well-defined shape. For objects with a well-defined shape, define an ObjectSchema instead.

Parameters

target

object

key

string

Returns

void

Example

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

@Resource
export class User {
  @field declare name: string;
  @object declare metadata: Record<string, unknown>;
}
json
[
  { "kind": "object", "name": "metadata" }
]

Since

5.9.0

Call Signature

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

Defined in: fields/object.ts:62

Decorator

Marks a property as an ObjectField — an object whose keys point to primitive values with no well-defined shape. For objects with a well-defined shape, define an ObjectSchema instead.

Parameters

options

ObjectFieldOptions

Returns

(target, key) => void

Example

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

@Resource
export class User {
  @field declare name: string;
  @object declare metadata: Record<string, unknown>;
}
json
[
  { "kind": "object", "name": "metadata" }
]

Since

5.9.0

Released under the MIT License.