0

I am not familiar with appsync's syntax with graphql. I am trying to update one of my entities using app sync. I used Amazon's option to automatically allocate resources and connect them to DynamoDB. Here is my entity:

type Property {
  id: ID!
  address: String!
  listedDate: AWSDate!
  notes: String
  homeType: String!
  tenantName: String!
  ownerName: String!
  leaseExpDate: AWSDate!
}

Inside of my mutations, I have this:

type Mutation {
  updateProperty(input: UpdatePropertyInput!): Property
}

Along with this input:

input UpdatePropertyInput {
  id: ID!
  address: String
  listedDate: AWSDate
  notes: String
  homeType: String
  tenantName: String
  ownerName: String
  leaseExpDate: AWSDate
}

Here is my attempt at the mutation to update the given property:

mutation updateProperty {
    updateProperty(input: UpdatePropertyInput(id: 'myID')) {
      address: String!
    }
}

The closest implementation that I found in the appsync's docs can be found here.

1 Answer 1

1

Input objects are constructed using brackets like below:

mutation updateProperty {
    updateProperty(input: {
      id: "myID",
      address: "myAddress"
    }) {
      address
    }
}

Here is some additional documentation on input objects can be found here:

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer as well as some documentation!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.