Dra*_*obZ 2 enums typescript graphql typegraphql
我正在尝试在解析器上为我的玩具 GraphQL API 创建一个可选过滤器,它使用type-graphql@1.0.0-rc.3和class-validator@0.12.0。当我运行似乎矛盾的查询时,我收到此错误消息。我已经非常仔细地遵循了文档中的枚举示例,但我确信我遗漏了一些东西。
这是查询:
{
authors(
field: "name",
op: "CONTAINS",
value: "Jones"
) {
id,
name
}
}
Run Code Online (Sandbox Code Playgroud)
结果:
{
"error": {
"errors": [
{
"message": "Enum \"FilterType\" cannot represent non-enum value: \"CONTAINS\". Did you mean the enum value \"CONTAINS\"?"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
和枚举
{
authors(
field: "name",
op: "CONTAINS",
value: "Jones"
) {
id,
name
}
}
Run Code Online (Sandbox Code Playgroud)
还有我的解析器/ArgsType。
{
"error": {
"errors": [
{
"message": "Enum \"FilterType\" cannot represent non-enum value: \"CONTAINS\". Did you mean the enum value \"CONTAINS\"?"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
GraphQL 中的双引号表示字符串文字。如果您的查询采用枚举值,则应省略引号:
{
authors(
field: "name",
op: CONTAINS,
value: "Jones"
) {
id,
name
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6399 次 |
| 最近记录: |