Skip to content

Commit

Permalink
feat(schema): add ReferenceType interface (#21692)
Browse files Browse the repository at this point in the history
Co-authored-by: cool-developer <[email protected]>
  • Loading branch information
aaronc and cool-develope authored Sep 16, 2024
1 parent 0147347 commit 397ff0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion schema/enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func (e EnumType) TypeName() string {
return e.Name
}

func (EnumType) isType() {}
func (EnumType) isType() {}
func (EnumType) isReferenceType() {}

// Validate validates the enum definition.
func (e EnumType) Validate(TypeSet) error {
Expand Down
9 changes: 9 additions & 0 deletions schema/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ type Type interface {
isType()
}

// ReferenceType is a marker interface that all types that can be the target of Field.ReferencedType implement.
// Currently, this is only EnumType.
type ReferenceType interface {
Type

// IsReferenceType is implemented if this is a reference type.
isReferenceType()
}

// TypeSet represents something that has types and allows them to be looked up by name.
// Currently, the only implementation is ModuleSchema.
type TypeSet interface {
Expand Down

0 comments on commit 397ff0b

Please sign in to comment.