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

Aperta
#270 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
fsharp
Ambito
api, backend

Direzione di ricerca

Usa la query e l’estratto dello schema come riproduzione minima; inizia tracciando il modo in cui il provider dei tipi GraphQL coerce i campi degli oggetti di input, in particolare i campi order_by e distinct_on con valori enum. Il lavoro è completato quando l’esempio compila e produce lo stesso risultato della query eseguita manualmente, con la copertura di questi casi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
F#
Stelle
406
Fork
74
Merge medio
1g 8h
PR unite (30g)
14

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fsprojects/FSharp.Data.GraphQL

Tutte le issue di fsprojects/FSharp.Data.GraphQL

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.