有什么方法可以导入应用了自定义指令的查询吗?
Is there any way of importing Query with a custom directive applied?
我想从 "./generated/prisma.graphql"
导入 Mutation.updateUser()
,但我还想添加 @isAdmin
指令。我可以通过手动复制查询来完成此操作:
type Mutation {
updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User @isAdmin
}
但这意味着我必须复制每一个 query/mutation/type 我想添加一个指令,有这样的语法吗?
# import Mutation.updateUser from "./generated/prisma.graphql" @isAdmin
很遗憾,目前无法做到这一点。默认情况下,GraphQL SDL 无法将类型或类型字段(如您所愿)导入其他文件。
根据您显示的 # import ...
语法,我相信您正在尝试使用 graphql-import
. With this library it's possible to import entire types but not individual fields of types. If you'd like to have that functionality in the graphql-import
library, please open an issue.
我想从 "./generated/prisma.graphql"
导入 Mutation.updateUser()
,但我还想添加 @isAdmin
指令。我可以通过手动复制查询来完成此操作:
type Mutation {
updateUser(data: UserUpdateInput!, where: UserWhereUniqueInput!): User @isAdmin
}
但这意味着我必须复制每一个 query/mutation/type 我想添加一个指令,有这样的语法吗?
# import Mutation.updateUser from "./generated/prisma.graphql" @isAdmin
很遗憾,目前无法做到这一点。默认情况下,GraphQL SDL 无法将类型或类型字段(如您所愿)导入其他文件。
根据您显示的 # import ...
语法,我相信您正在尝试使用 graphql-import
. With this library it's possible to import entire types but not individual fields of types. If you'd like to have that functionality in the graphql-import
library, please open an issue.