aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
89 stars 79 forks source link

Model missing fields in creation mutation #312

Open arlyon opened 4 years ago

arlyon commented 4 years ago

Describe the bug

I have a schema:

type PageBlock {
    title: TranslateableText!
    titleAudio: Int!

    icon: String!
    headerImage: AWSURL
    blocks: [Block!]!
}

type ParagraphBlock {
    text: TranslateableText!
    audio: Int!
}

type HeaderBlock {
    text: TranslateableText!
    audio: Int!
}

type ImageBlock {
    url: AWSURL!
}

union Block = ParagraphBlock | HeaderBlock | ImageBlock

type Page @model {
    id: ID!
    page: PageBlock!
    ... more
}

One of the fields of my Page model is a PageBlock, which has 0 or more sub-blocks. I can query these just fine:

query {
  getPage(id: "my_page") {
    page{
      blocks{
        ... on HeaderBlock {
          text {source}
          audio
        }
        ... on ParagraphBlock {
          text {source}
          audio
        }
        ... on ImageBlock {
          url
        }
      }
    }
  }
}

I can't however create page blocks. How do I do this?

Amplify CLI Version

4.19.0

Expected behavior

I would expect to be able to create unions.

attilah commented 4 years ago

@arlyon Thanks for reporting it, I was able to recreate this problem you were raising, I take it to the team for discussion.