hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.18k stars 2.77k forks source link

Graphql explorer is broken when scalar "bool" exists. #3708

Open unlinking opened 4 years ago

unlinking commented 4 years ago

Explorer is broken when there is a scalar named "bool".

IntrospectionQuery Result

{
  "data": {
    "__schema": {
      "directives": [],
      "mutationType": {
        "name": "Mutation"
      },
      "queryType": {
        "name": "Query"
      },
      "subscriptionType": null,
      "types": [
        {
          "description": "",
          "fields": [
            {
              "args": [
                {
                  "defaultValue": null,
                  "description": "",
                  "name": "test",
                  "type": {
                    "kind": "NON_NULL",
                    "name": null,
                    "ofType": {
                      "kind": "SCALAR",
                      "name": "string",
                      "ofType": null
                    }
                  }
                }
              ],
              "description": "",
              "name": "test",
              "type": {
                "kind": "NON_NULL",
                "name": null,
                "ofType": {
                  "kind": "SCALAR",
                  "name": "bool",
                  "ofType": null
                }
              }
            },
            {
              "args": [],
              "description": "",
              "name": "version",
              "type": {
                "kind": "NON_NULL",
                "name": null,
                "ofType": {
                  "kind": "SCALAR",
                  "name": "string",
                  "ofType": null
                }
              }
            }
          ],
          "kind": "OBJECT",
          "name": "Mutation"
        },
        {
          "description": "",
          "fields": [
            {
              "args": [],
              "description": "",
              "name": "version",
              "type": {
                "kind": "NON_NULL",
                "name": null,
                "ofType": {
                  "kind": "SCALAR",
                  "name": "string",
                  "ofType": null
                }
              }
            }
          ],
          "kind": "OBJECT",
          "name": "Query"
        },
        {
          "description": "",
          "fields": [],
          "kind": "SCALAR",
          "name": "bool"
        },
        {
          "description": "",
          "fields": [],
          "kind": "SCALAR",
          "name": "string"
        }
      ]
    }
  },
  "errors": null
}

Got an error":{"path":"$","error":"type info not found for: 'bool'","code":"unexpected"}

query and mutation still works, but graphql explorer is broken.

0x777 commented 4 years ago

@lulucas Can you help us reproduce this? It would be great if you can share the schema (and metadata).

unlinking commented 4 years ago

@lulucas Can you help us reproduce this? It would be great if you can share the schema (and metadata).

scalar bool

type Mutation {
  fine: bool!
}

type Query {
  fine: bool!
}

Simply scalar "bool" existing is enough, as a remote schema.

@0x777

tirumaraiselvan commented 4 years ago

@lulucas I am not able to reproduce this in v1.3.0-beta.x with a remote schema which has this schema:

scalar bool

type Mutation {
  fine: bool!
}

type Query {
  fine: bool!
}

Can you verify?