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

Call Signature

ts
function attribute(target, key): void;

Defined in: fields/attribute.ts:60

Decorator

CAUTION

This decorator is LEGACY. Prefer field for new schemas; only use this decorator on resources decorated with @Resource({ legacy: true }).

Marks a property as a LegacyAttributeField for use with @warp-drive/legacy/model.

Parameters

target

object

key

string

Returns

void

Example

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

@Resource({ legacy: true })
export class Comment {
  @attribute({ type: 'string' }) declare author: string;
}
json
[
  { "kind": "attribute", "name": "author", "type": "string" }
]

Since

5.9.0

Call Signature

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

Defined in: fields/attribute.ts:61

Decorator

CAUTION

This decorator is LEGACY. Prefer field for new schemas; only use this decorator on resources decorated with @Resource({ legacy: true }).

Marks a property as a LegacyAttributeField for use with @warp-drive/legacy/model.

Parameters

options

AttributeOptions

Returns

(target, key) => void

Example

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

@Resource({ legacy: true })
export class Comment {
  @attribute({ type: 'string' }) declare author: string;
}
json
[
  { "kind": "attribute", "name": "author", "type": "string" }
]

Since

5.9.0

Released under the MIT License.