Skip to content

[ra-data-graphql-simple] Documented GraphQL Schema Type for delete mutation is incorrect #2338

Description

@kpollich

What you were expecting:

The README for react-data-graphql-simple documents a deletePost mutation with the signature:

deletePost(id: ID!): Boolean

I expect to be able to implement this mutation for my resources in my GraphQL schema, and have react-admin run it correctly.

What happened instead:

react-admin is querying for an id field on the deleteState (State is my resource), which throws a GraphQL error since deleteState is set to return a Boolean.

screenshot 2018-09-19 12 22 24

Steps to reproduce:

Other information:

Environment

  • React-admin version: 2.2.3

Error Payload:

{
  "errors": [
    {
      "message": "Field \"deleteState\" must not have a selection since type \"Boolean\" has no subfields.",
      "locations": [{ "line": 2, "column": 30 }],
      "extensions": {
        "code": "GRAPHQL_VALIDATION_FAILED",
        "exception": {
          "stacktrace": [
            "Field \"deleteState\" must not have a selection since type \"Boolean\" has no subfields.",
            "",
            "GraphQL request (2:30)",
            "1: mutation deleteState($id: ID!) {",
            "2:   data: deleteState(id: $id) {",
            "                                ^",
            "3:     id",
            "",
            "    at Object.Field (/Users/kyle_pollich/Workspace/work/artifex-press/replatform/artifex-press-api/node_modules/graphql/validation/rules/ScalarLeafs.js:50:33)",
            "    at Object.enter (/Users/kyle_pollich/Workspace/work/artifex-press/replatform/artifex-press-api/node_modules/graphql/language/visitor.js:343:29)",
            "    at Object.enter (/Users/kyle_pollich/Workspace/work/artifex-press/replatform/artifex-press-api/node_modules/graphql/language/visitor.js:394:25)",
            "    at visit (/Users/kyle_pollich/Workspace/work/artifex-press/replatform/artifex-press-api/node_modules/graphql/language/visitor.js:261:26)",
            "    at Object.validate (/Users/kyle_pollich/Workspace/work/artifex-press/replatform/artifex-press-api/node_modules/graphql/validation/validate.js:63:22)",
            "    at Promise.resolve.then (/Users/kyle_pollich/Workspace/work/artifex-press/replatform/artifex-press-api/node_modules/apollo-server-core/src/runQuery.ts:188:30)",
            "    at <anonymous>",
            "    at process._tickCallback (internal/process/next_tick.js:188:7)"
          ]
        }
      }
    }
  ]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions