Skip to content

GraphQL: Using generic Mutation can lead to unwanted result #5925

Closed
@Moumouls

Description

@Moumouls

Issue Description

Using a generic Mutation can lead to unwanted result, more specifically on data types like: Array/Relation.

Steps to reproduce

Create a new Object (with new field) and an array of Pointers

mutation {
  objects {
    create(
      className: "SomeClass"
      fields: {
        relation: [
          { __type: "Pointer", className: "Country", objectId: "GFFCf5dxKW" }
        ]
      }
    ) {
      objectId
    }
  }
}

Expected Results

relation field must be a Relation

Actual Outcome

Capture d’écran 2019-08-15 à 23 32 45

The data type is interpreted as an Array

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : master
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): localhost
  • Database

    • MongoDB

Suggestion

I think that generic Mutations isn't suitable in real GraphQL app but it's useful for testing the current GraphQL feature. The generic Mutation currently seems to be a black box and can be confusing for new developers who are not familiar with SDKs (Polygon, ACL, Pointer, etc...)

In fact, I think that in most applications that will use the Parse GraphQL as API, the SDKs will be used little or not at all to interact with the GraphQL because it is not comfortable and really logical to combine a SDK and a API GraphQL in terms of developer experience.

We should teach developers to create first a schema with a well designed createClass/createSchema Mutation and then use a specific Mutation

What do you think about this @davimacedo @omairvaiyani @douglasmuraoka ?

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