diff --git a/entgql/annotation.go b/entgql/annotation.go index 76cab56a3..c8cb53c03 100644 --- a/entgql/annotation.go +++ b/entgql/annotation.go @@ -41,8 +41,8 @@ type ( // RelayConnection enables the Relay Connection specification for the entity. // It's also can apply on an edge to create the Relay-style filter. RelayConnection bool `json:"RelayConnection,omitempty"` - // Implemented are extra interfaces that are implemented. - Implemented []string `json:"Implemented,omitempty"` + // Implements defines a list of interfaces implemented by the type. + Implements []string `json:"Implements,omitempty"` // Directives to add on the field/type. Directives []Directive `json:"Directives,omitempty"` } @@ -114,9 +114,9 @@ func RelayConnection() Annotation { return Annotation{RelayConnection: true} } -// Implemented returns an Implemented annotation. -func Implemented(interfaces ...string) Annotation { - return Annotation{Implemented: interfaces} +// Implements returns an Implements annotation. +func Implements(interfaces ...string) Annotation { + return Annotation{Implements: interfaces} } // Directives returns a Directives annotation. @@ -155,8 +155,8 @@ func (a Annotation) Merge(other schema.Annotation) schema.Annotation { if ant.RelayConnection { a.RelayConnection = true } - if len(ant.Implemented) > 0 { - a.Implemented = append(a.Implemented, ant.Implemented...) + if len(ant.Implements) > 0 { + a.Implements = append(a.Implements, ant.Implements...) } if len(ant.Directives) > 0 { a.Directives = append(a.Directives, ant.Directives...) diff --git a/entgql/internal/todoplugin/ent/schema/category.go b/entgql/internal/todoplugin/ent/schema/category.go index 5f3d64281..7891a1010 100644 --- a/entgql/internal/todoplugin/ent/schema/category.go +++ b/entgql/internal/todoplugin/ent/schema/category.go @@ -68,7 +68,7 @@ func (Category) Fields() []ent.Field { Optional(). Annotations( entgql.Type("Uint64"), - entgql.Directives(entgql.DeprecatedDirective("We don't use this field anymore")), + entgql.Directives(entgql.Deprecated("We don't use this field anymore")), ), field.Strings("strings"). Optional(), @@ -87,6 +87,6 @@ func (Category) Edges() []ent.Edge { func (Category) Annotations() []schema.Annotation { return []schema.Annotation{ entgql.RelayConnection(), - entgql.Implemented("Entity"), + entgql.Implements("Entity"), } } diff --git a/entgql/schema.go b/entgql/schema.go index 905a83ee1..a4b85a578 100644 --- a/entgql/schema.go +++ b/entgql/schema.go @@ -144,8 +144,8 @@ func (e *schemaGenerator) buildTypes() (map[string]*ast.Definition, error) { typ.Name = ant.Type typ.Directives = append(typ.Directives, goModel(e.entGoType(node.Name))) } - if len(ant.Implemented) > 0 { - typ.Interfaces = append(typ.Interfaces, ant.Implemented...) + if len(ant.Implements) > 0 { + typ.Interfaces = append(typ.Interfaces, ant.Implements...) } insertDefinitions(types, typ)