module@warp-drive/schema-dsl
Decorator schemaObject() sincev5.9.0
ts
function schemaObject(options): (target, key) => void;Defined in: fields/schema-object.ts:112
Decorator
Marks a property as a SchemaObjectField — an embedded object whose shape is described by an ObjectSchema.
This is not a relationship. @belongsTo / ResourceField point at another resource by identity. A schema-object is stored inline on the parent and has no identity of its own.
For a bag of primitives with no schema, use object instead.
Parameters
options
Returns
(target, key) => void
Example
ts
import { Resource, field, schemaObject } from '@warp-drive/schema-dsl';
@Resource
export class User {
@field declare name: string;
@schemaObject({ type: 'address' }) declare address: Address;
}json
[
{ "kind": "schema-object", "name": "address", "type": "address" }
]