【发布时间】:2019-11-11 14:57:28
【问题描述】:
我刚刚学习 .NET Core 和 GraphQL,无法从网络上获得一个示例(我已经尝试了十几个)来工作。他们都在使用这个库https://graphql-dotnet.github.io,每次我尝试使用有效的 GraphQL 查询访问端点时,我都会得到以下响应:
{
"errors": [
{
"message": "Unmapped selection Field",
"extensions": {
"code": "EXECUTION_ERROR"
}
}
]
}
其中一个例子:https://github.com/mmacneil/ASPNetCoreGraphQL
我似乎找不到任何与该错误相关的内容,并且有关该错误的文档也没有太多帮助。我希望有人在图书馆工作过并且遇到过同样的问题。
这是在 GraphQLController 中执行的查询结果的错误:
InnerException = {GraphQL.ExecutionError: Unmapped selection Field
at GraphQL.Language.CoreToVanillaConverter.Selection(ASTNode source)
at GraphQL.Language.CoreToVanillaConverter.SelectionSet(GraphQLSelectionSet source)
at GraphQL.Language.CoreToVanillaConverter.Operation(GraphQLOperationDefinition source)
at GraphQL.Language.CoreToVanillaConverter.AddDefinitions(GraphQLDocument source, Document target)
at GraphQL.Language.CoreToVanillaConverter.Convert(String body, GraphQLDocument source)
at GraphQL.Execution.GraphQLDocumentBuilder.Build(String body)
at GraphQL.DocumentExecuter.ExecuteAsync(ExecutionOptions options)
这也是我在这里的第一篇文章。如果您需要更多信息,请告诉我。
【问题讨论】:
-
奇怪的是,我们突然开始在基于 GraphQL 的项目中间歇性地遇到同样的事情。从调试和阅读 GraphQL 源代码来看,它看起来不应该遇到那个异常。您介意告诉我您使用的是什么环境吗?
-
查看此问题:github.com/graphql-dotnet/parser/issues/28 这是一个无意的不兼容更改。
标签: c# asp.net-core graphql