Skip to content
@legacy

Documentation / @warp-drive/legacy / model-fragments / withFragmentDefaults

Function: withFragmentDefaults()

ts
function withFragmentDefaults<FragmentType, FragmentName>(fragmentType, fragmentName?): object;

Defined in: warp-drive-packages/legacy/src/model-fragments/utilities/with-fragment-defaults.ts:9

Used as a helper to setup the relevant parts of a fragment schema and add extensions etc.

Type Parameters

FragmentType

FragmentType extends string

FragmentName

FragmentName extends string

Parameters

fragmentType

FragmentType

The type of the fragment

fragmentName?

FragmentName

The optional name of the fragment. If not provided, it will default to the fragmentType.

Returns

object

The schema for a fragment

kind

ts
kind: "schema-object";

name

ts
name: FragmentType | FragmentName;

options

ts
options: object;

options.objectExtensions

ts
objectExtensions: string[];

type

ts
type: `fragment:${FragmentType}`;

Released under the MIT License.