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

Interface SchemaObjectOptions

Defined in: fields/schema-object.ts:11

Options accepted by the schemaObject decorator.

Properties

defaultValue?

ts
optional defaultValue?: boolean;

Defined in: fields/schema-object.ts:74

If true, a missing cache value becomes {} instead of null. Ignored when polymorphic is true. Compiles onto the SchemaObjectField's options.defaultValue.


polymorphic?

ts
optional polymorphic?: boolean;

Defined in: fields/schema-object.ts:50

Whether this field may contain more than one object-schema type. Compiles onto the SchemaObjectField's options.polymorphic.

This is not resource-relationship polymorphism: there is no inverse, no async, and no as trait. Runtime picks the object schema by reading typeField from the raw cache value, or by running the hash function named by type when typeField is '@hash'.


sourceKey?

ts
optional sourceKey?: string;

Defined in: fields/schema-object.ts:36

The name of the field as returned by the API, if it differs from the decorated property's name. Compiles onto the SchemaObjectField's sourceKey.


type?

ts
optional type?: string | null;

Defined in: fields/schema-object.ts:27

If the field is not polymorphic, the type of the ObjectSchema that describes the embedded object.

If the field is polymorphic and typeField is '@hash', the name of the HashFn used to compute the object type from the raw cache value.

If the field is polymorphic and typeField is a payload key, this may be omitted (compiles to null). Runtime reads the type from that key.

Compiles onto the SchemaObjectField's type.


typeField?

ts
optional typeField?: string;

Defined in: fields/schema-object.ts:65

When polymorphic is true, the key on the raw cache value that holds the object-schema type, or '@hash' to compute it.

Compiles onto the SchemaObjectField's options.type. Runtime defaults to 'type' when this is omitted.

Named typeField on the decorator so it does not collide with type (the object-schema or hash function name).

Released under the MIT License.