我正在开发一个名为bind
的GraphQL指令,可将其用于字段以解析为另一个值。
# This is a simplification of the actual definitions
directive @bind(value: String) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
input Request {
expr: String! @bind(value: "/v1.0/std/expr")
}
type Response {
message: String
}
type Query {
hello(request: Request): Response
}
如果expr
是非空字符串,则效果很好。我希望即使expr
为空,也要调用我的指令。
请告诉我如何?