Skip to content
module@warp-drive/core/types/schema/fields

Interface LegacyResourceSchema ​

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2258

Represents a schema for a primary resource in LegacyMode

Primary resources are objects with a unique identity of their own which may allow them to appear in relationships, or in multiple response documents.

Properties ​

fields ​

ts
fields: LegacyModeFieldSchema[];

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2302

The fields that make up the shape of the resource


identity ​

ts
identity: IdentityField;

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2275

This should be an IdentityField.

To maximize compatibility with Model where id was the name of the identity field, we recommend using { kind: '@id', name: 'id' } for records in legacy mode, but this is not required.


legacy ​

ts
legacy: true;

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2264

A flag indicating that this is a legacy resource schema


objectExtensions? ​

ts
optional objectExtensions?: string[];

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2329

⚠️ Dangerous Feature Ahead

Configures which extensions this resource should use.

Extensions are registered with the store's schema service via SchemaService.CAUTION_MEGA_DANGER_ZONE_registerExtension

Extensions should only be used for temporary enhancements to objects to support migrating away from deprecated patterns like custom getters, computeds, and methods


traits? ​

ts
optional traits?: string[];

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2314

A list of traits that this resource implements. The fields for these traits should still be defined in the fields array.

Each trait should be a string that matches the type of another resource schema. The trait can be abstract and reference a resource type that is never defined as a schema.


type ​

ts
type: string;

Defined in: warp-drive-packages/core/src/types/schema/fields.ts:2295

The name of the schema

For cacheable resources, this should be the primary resource type.

The names of object and resource schemas share a single namespace and must not conflict.

We recommend a naming convention for object schemas such as below for ensuring uniqueness:

  • for globally shared objects: The pattern $field:${KlassName} e.g. $field:AddressObject
  • for resource-specific objects: The pattern $${ResourceKlassName}:$field:${KlassName} e.g. $User:$field:ReusableAddress
  • for inline objects: The pattern $${ResourceKlassName}.${fieldPath}:$field:anonymous e.g. $User.shippingAddress:$field:anonymous

Released under the MIT License.