Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(schema): add ReferenceType interface #21692

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading