Jeff
Jeff

Reputation: 1879

How to structure mutation in GraphiQL Browser Playground?

Performing established GraphiQL schema within its browser playground, query requests run without issue. The backend store is initially expected to be empty.

schema query appCount: Int!

query {
  appCount
}

{
  "data": {
    "appCount": 0
  }
}

Expected mutation schema used populate its backend storage:

schema mutation putApp(app: AppInputGraphType = null): MutationResultOutputGraphType!

AppInputGraphType {
  id: ID!
  provider: String!
  siteName: String!
  externalAccountId: Int!
  ***
}

MutationResultOutputGraphType {
  success: Boolean!
}

All attempts requesting mutation putApp(app) have failed, assuming that the parameter/fields layout is incorrect:

mutation {
  putApp(app: {
      id: 1234,
      provider: "box", 
      siteName: "hqtest3", 
      externalAccountId: 5678,
      ***
    }
  )
}

{
  "errors": [
    {
      "message": "GraphQL.Validation.ValidationError: Field putApp of type MutationResultOutputGraphType! must have a sub selection",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],

How to correct this mutation request?

Upvotes: 0

Views: 56

Answers (1)

Jeff
Jeff

Reputation: 1879

Added sub-selection of type MutationResultOutputGraphType

mutation {
  putApp(app: {
      id: 1234,
      provider: "box", 
      siteName: "hqtest3", 
      externalAccountId: 5678,
      ***
    }
  ) {
    success
  }
}

Upvotes: 0

Related Questions