amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

Codegen adds duplicate localUri and mimeType fields to S3ObjectInput

Open palpatim opened this issue 7 years ago • 4 comments

Describe the bug

Prior to complex object support being baked into the CLI, customers had to add the objects manually, so some schemas include definitions like:

type S3Object {
  bucket: String!
  region: String!
  key: String!
}

input S3ObjectInput {
  bucket: String!
  region: String!
  key: String!
  localUri: String!
  mimeType: String!
}

Running amplify codegen against that schema in an iOS project produces an S3ObjectInput struct with duplicate declarations of localUri and mimeType:

public struct S3ObjectInput: GraphQLMapConvertible {
  public var graphQLMap: GraphQLMap

  public init(bucket: String, region: String, key: String, localUri: String, mimeType: String, localUri: String, mimeType: String) {
    graphQLMap = ["bucket": bucket, "region": region, "key": key, "localUri": localUri, "mimeType": mimeType, "localUri": localUri, "mimeType": mimeType]
  }
...

Expected behavior

Codegen should inspect the S3ObjectInput fields for the existence of localUri and mimeType, and not add them if they are already there.

Desktop (please complete the following information):

  • OS: MacOS 10.14.6
  • Browser: N/A
  • Version: N/A
  • Amplify version: 1.8.5

palpatim avatar Jul 26 '19 15:07 palpatim

@palpatim Thanks for reporting this, this is a bug, we will send out a fix soon. Additional information: API.swift file is created after the amplify push, but its contents are almost empty other than the one line "import AWSAppSync" at the tope. Contents are filled only after explicitly executing amplify codegen.

UnleashedMind avatar Jul 26 '19 18:07 UnleashedMind

This is still happening, Sept 1, 2019.

romeoflute avatar Aug 31 '19 16:08 romeoflute

This is still happening Feb 18th 2021

ghost avatar Feb 19 '21 08:02 ghost

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

github-actions[bot] avatar May 25 '21 03:05 github-actions[bot]