简体   繁体   中英

AWS Amplify removes “id” field after uploading GraphQL Schema

I am using AWS Amplify to configure Appsync in my project. In my schema.graphql, I have the following types:

type Post @model {
  id: ID!
  tweet: Tweet
}

type Tweet {
  id: ID
  text: String!
}

Tweet is a nested object under Post, it is intentionally not a @model.

When I upload to AWS via the cli ( amplify push ), it removes the Tweet's id field from TweetInput on the generated schema. This is the generated schema from the AWS console:

input CreatePostInput {
    id: ID
    tweet: TweetInput
}

type Tweet {
    id: ID
    text: String!
}

input TweetInput {
    text: String!
}

I have searched the Appsync documentation, but I cannot find anywhere that says I can't use an id field on an object type.

Is there any way around this? I'd like to avoid renaming the field if I can.

Turns out that this is a bug in the CLI https://github.com/aws-amplify/amplify-cli/issues/1984

Hopefully it gets resolved soon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM