With the recent support of native GraphQL, dgraph introduced the use of @hasInverse
and @search
directives. When I write my schema in my editor, the linter warns me about those unknown directive.
(
Unknown directive "search"
and Unknown directive "hasInverse"
)
I therefore described the directives in a file directive.schema
as follow:
enum SearchTypes {
hash,
exact,
regexp,
term,
fulltext
}
directive @search(by: [SearchTypes]) on FIELD_DEFINITION
directive @hasInverse(field: __EnumValue) on FIELD_DEFINITION
type DateTime
And the errors are gone… however, I am not very satisfied in redefining directives that may be already provided by dgraph. They can be error prone.
Is there any better alternative to this?