The type to reference (named type, class, or union definition)
// Schema mode - reference other schema types
const Position = ObjectType("Position", {
x: FloatType(),
y: FloatType(),
});
const Direction = EnumType("Direction", ["up", "down", "left", "right"]);
const Player = ObjectType("Player", {
position: ReferenceType(Position),
facing: ReferenceType(Direction),
});
Create a reference to another named type, class, or union.
Use references to compose schemas from reusable type definitions. References work differently depending on the mode:
// Schema mode - reference other schema types
const Position = ObjectType("Position", {
x: FloatType(),
y: FloatType(),
});
const Direction = EnumType("Direction", ["up", "down", "left", "right"]);
const Player = ObjectType("Player", {
position: ReferenceType(Position),
facing: ReferenceType(Direction),
});
Create a reference to another named type, class, or union.
Use references to compose schemas from reusable type definitions. References work differently depending on the mode:
// Schema mode - reference other schema types
const Position = ObjectType("Position", {
x: FloatType(),
y: FloatType(),
});
const Direction = EnumType("Direction", ["up", "down", "left", "right"]);
const Player = ObjectType("Player", {
position: ReferenceType(Position),
facing: ReferenceType(Direction),
});
Create a reference to another named type, class, or union.
Use references to compose schemas from reusable type definitions. References work differently depending on the mode: