Zaid-Ajaj / Snowflaqe

A dotnet CLI to generate type-safe GraphQL clients for F# and Fable with automatic deserialization, static query verification and type checking
MIT License
157 stars 26 forks source link

Issue with query validation? #9

Closed njlr closed 4 years ago

njlr commented 4 years ago

My schema:

type Foo {
  id: ID!
  name: String!
}

type Query {
  foo(id: ID!): Foo
}

My query:

query($id: ID!) {
  foo(id: $id) {
    id
    name
  }
}

But I get a validation error:

Field foo contains type mismatch for argument id of type ID! which references variable $id of type ID!

This is unexpected since id and $id have the same type (ID!).

njlr commented 4 years ago

It works if I change ID! to String!, so it's probably just a missing case somewhere.

njlr commented 4 years ago

If I had to guess, it's probably here: https://github.com/Zaid-Ajaj/Snowflaqe/blob/14449d5343688bbe16b6eabcba9b4baa08905528/src/Query.fs#L329 (no case for "ID")

Zaid-Ajaj commented 4 years ago

Hi @njlr, thanks a lot for filing the issue with the relevant debug information. Indeed I missed a case in the validation code but it should be fixed as of v1.5.1 :smile: