Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Compile-time error: "Argument field or value named 'order_by' can not be coerced"

未关闭
#270 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
fsharp
领域
api, backend

调研方向

使用查询和 schema 片段作为最小复现;首先跟踪 GraphQL 类型提供程序如何强制转换输入对象字段,尤其是枚举值的 order_by 和 distinct_on 字段。完成的标准是示例能够编译,并产生与手动运行的查询相同的结果,同时覆盖这些情况。

由索引模型根据 Issue 内容生成。

描述

Description

I am using Hasura, and trying to run the following query:

let operation = MyProvider.Operation<"""query q {
      test_table (order_by: {some_name: asc}) {
        id
        some_name
      }
    }""">

The query is valid and works if run manually, but I get a compile-time error with the F# Type Provider:

error FS3033: The type provider 'FSharp.Data.GraphQL.Client.GraphQLTypeProvider'
reported an error:
Argument field or value named 'order_by' can not be coerced.
It does not match a valid literal representation for the type.
Path: ["q"; "test_table"]

The relevant part of the schema:

{
  "inputFields": null,
  "kind": "ENUM",
  "possibleTypes": null,
  "interfaces": null,
  "name": "order_by",
  "enumValues": [
    {
      "isDeprecated": false,
      "deprecationReason": null,
      "name": "asc",
      "description": "in the ascending order, nulls last"
    },
  ...
  ],
  "description": "column ordering options",
  "fields": null
}

I've tried other parameters, such as offset, limit, where (this one works now: https://github.com/fsprojects/FSharp.Data.GraphQL/issues/263), and they work. distinct_on, however, results in the same compile time error. Could this have something to do with the _ in the name?

Repro steps

See description.

Expected behavior

The application compiles, the query returns the same result as when run manually.

Actual behavior

Compile-time error.

Known workarounds

None.

Related information
  • Mac OS X
  • Version 1.0.3
  • .NET Core 3.1
主要语言
F#
星标
406
派生
74
平均合并
1 天 8 小时
30 天内合并 PR
14

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fsprojects/FSharp.Data.GraphQL 的其他 Issue

查看 fsprojects/FSharp.Data.GraphQL 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。