feat(schema): add ReferenceType interface (#21692)

Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com>
This commit is contained in:
Aaron Craelius 2024-09-16 04:17:30 -04:00 committed by GitHub
parent 01473479c7
commit 397ff0bd22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -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 {

View File

@ -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 {