【发布时间】:2020-02-28 23:42:16
【问题描述】:
随着最近对原生 GraphQL 的支持,dgraph 引入了 @hasInverse 和 @search 指令的使用。当我在编辑器中编写架构时,linter 会警告我那些未知指令。
(Unknown directive "search" 和 Unknown directive "hasInverse")
因此,我在文件 directive.schema 中将指令描述如下:
enum SearchTypes {
hash,
exact,
regexp,
term,
fulltext
}
directive @search(by: [SearchTypes]) on FIELD_DEFINITION
directive @hasInverse(field: __EnumValue) on FIELD_DEFINITION
type DateTime
并且错误消失了……但是,我对重新定义 dgraph 可能已经提供的指令不是很满意。它们很容易出错。
有没有更好的选择?
【问题讨论】:
标签: graphql schema directive dgraph