module@warp-drive/schema-dsl
Decorator attribute()
ts
function attribute(target: object, key: string): void;
function attribute(options: AttributeOptions): (target: object, key: string) => void;Call Signature
sincev5.9.0ts
function attribute(target: object, key: string): void;Defined in: fields/attribute.ts:64
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" }
]Call Signature
sincev5.9.0ts
function attribute(options: AttributeOptions): (target: object, key: string) => void;Defined in: fields/attribute.ts:65
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
Returns
(target: object, key: string) => 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" }
]