Skip to content

Bug: field with Boolean type fails in defineByDocumentFile #277

@charlescrain

Description

@charlescrain

Here is the error I get when I attempted to access a boolean field:

• Expecting one more argument to ‘Boolean’
  Expected a type, but ‘Boolean’ has kind ‘Bool -> ScalarValue’
• In the first argument of ‘Maybe’, namely ‘Boolean’
  In the type ‘(Maybe Boolean)’
  In the definition of data constructor ‘CharacterCreature’

Side note : it requires DataKinds extensions to get this error. Without DataKinds error is:

Not in scope: type constructor or class ‘Boolean’
A data constructor of that name is in scope; did you mean DataKinds?

Example schema and code below:

simple.gql :

type Query {
  deity (name: [[[[[String!]]!]]], mythology: Realm): Deity!
  character (characterID: String! , age: Int ): Character!
  hero: Human!
}

interface MyInterface {
    name: String
}

type Mutation {
  createDeity (name: [[[[[String!]]!]]], mythology: String): Deity!
  createCharacter (realm: Realm! , id: String! ): Character!
}

union Character = Creature | Deity  | Human

type Deity {
  fullName: String!
  power: Power
}

type Creature {
  creatureName: String!
  realm: City!
  test: Boolean
}

type Human {
  humanName: String!
  lifetime: Lifetime!
  profession: Profession
}

enum Profession {
    Priest
    Farmer
    Artist
}

input Realm {
  owner: String!
  age: Int
  realm: Realm
  profession: Profession
}

enum City {
    Athens
    Ithaca
    Sparta Troy
}

scalar Lifetime
scalar Power

Failing haskell code:

defineByDocumentFile "./schema.gql"
  [gql|
      query Character($id: String!) {
        character(characterID: $id) {
          ...on Creature {
            test
          }
        }
      }
  |]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions