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

ModelSchema pluralName changing to listPluralName and syncPluralName

Open lawmicha opened this issue 4 years ago • 2 comments

Describe the bug Due to CLI changes to how names are pluralized for list query operations, we're working on a backwards compatible fix for existing developers. Issue: https://github.com/aws-amplify/amplify-cli/issues/8350 Codegen changes: https://github.com/aws-amplify/amplify-codegen/issues/252 iOS changes: https://github.com/aws-amplify/amplify-ios/pull/1451 Android tracking issue: https://github.com/aws-amplify/amplify-android/issues/1521

This work will most likely result in deprecating pluralName for syncPluralName since we are introducing listPluralName for backwards compatability, and it would be confusing to keep pluralName. This changes how ModelSchemas are created in Flutter

Before

ModelSchema(name: "Post", pluralName:"Posts")

After

ModelSchema(name: "Post", listPluralName: "Posts", syncPluralName: "Posts:)

Flutter should wait until this change is finalized across iOS/Android and codegen before making this change. Codegen is also planning to stop generating pluralName since syncPluralName will be generated. This means the ModelSchema for new developers will be missing pluralName and requires the dependent libraries to use syncPluralName like:

sync: graphQLName = syncPluralName ?? pluralName ?? name + "s"

I think means that until Flutter makes the change to stop using pluralName, it will rely on the native libraries to continue falling back onto the pluralName for the sync query name. Since Flutter hasn't launched support for Amplify.API.query(.list) then there's no places that generates the list query name

lawmicha avatar Oct 05 '21 18:10 lawmicha

@lawmicha Has this been finalized across iOS/Android and codegen?

Jordan-Nelson avatar Mar 08 '22 15:03 Jordan-Nelson

The changes have been finalized to

  • iOS / Android libraries are backwards compatible with the older properties being codegenerated, and have made the changes to support the new properties.
  • now we're waiting for the codegen changes to be released here https://github.com/aws-amplify/amplify-codegen/pull/255 to actually generate the new properties
  • The codegen changes went through a few iterations, initially we added the Flutter codegen changes and then removed it because the Flutter library needs to release a version of the library which handles both before we introduce the Flutter codegen changes. So whenever Flutter picks this up (see iOS and Android changes if more details is needed), then we can make the changes to codegen for dart codegen like in https://github.com/aws-amplify/amplify-codegen/pull/255

lawmicha avatar May 08 '22 14:05 lawmicha