-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL List Query name changed #8350
Comments
what is the feature flag with the fix? Do we need the same feature flag in the library that corresponds to the CLI's feature flag so that developers can upgrade both at the same time? Update: https://github.com/aws-amplify/amplify-cli/pull/7258/files#r720912006 |
my workaround at the moment is to comment out the |
Hey @lawmicha 👋 thank you for taking the time to raise this with details! Using the posted example I was able to observe the noted error. However, I do see where this can cause further issues. If attempting to use the following schema: type Wish @model {
id: ID!
name: String!
description: String
}
type Wishes @model {
id: ID!
name: String!
description: String
} We'll receive the following error when attempting to push or run
Which, although not explicitly noting there is a collision with the two models' list queries, we are not able to proceed with a push.
The feature flag to turn off this pluralization is Marking as a bug 🙂 and looks like we need to:
|
hey @josefaidt, thanks for taking a look. I'm still trying to figure out how to solve the following:
|
@lawmicha does the Andoid and iOS use the code generated by the amplify-modelgen? If so, from what I can see there is a field called |
Thanks @yuth ! Latest on this is..
Library code can use this information if it exists, otherwise, fallback to
|
@josefaidt can we set |
When do we expect a fix for this? When I create a model named |
Hey @lawmicha I am a bit confused about this issue report - hopefully you can provide clarification. First, it looks like there are two issues described here. The first is that, if you create two models, one called In this case, what is your reasoning for having these two models, and what do you expect the resulting graphql list queries to be? In CLI v5.0.1 the queries would not conflict because they were generated as The second is that code in the iOS library uses a pluralization scheme that mismatches with the pluralization scheme used to create the functioning graphql queries. By the sounds of it, this would impact any app with a model like I am not sure how this issue manifests. I tried creating an iOS app with a model called Side note on statements like "Existing developers cannot upgrade to a fixed version of the iOS library" and "New projects using latest CLI cannot use Amplify iOS library." I see there's conversation above on feature flags and how they work. Do you still feel that either or both of these statements are true? If they are, it sounds like no one has been able to develop iOS apps using amplify in months. I want to better understand the scope of the problem here. |
I agree the first issue related to having two models that end up with conflicting resolver names is unavoidable. I only used them as part of the investigation from the customer issues and to understand the behavior of the CLI. Because of the conflicts, i had to create two separate projects to see what the pluralization logic is for both of them. For the second issue, I understand it may be a bit confusing to connect the dots since the CLI flow asks to generate an API.swift which is used for AppSync SDK that we are not actively working on. Amplify.API documentation follows Both statements are still true because even with the feature flag, we are lacking the merged codegen changes that provide the additional information about what is a list query name, so that it can be used as the source of truth in the fixed library code. The scope is only impacting Amplify.API users using the list query |
I'm going to close this out, as I believe it was addressed a while back on the CLI side. If this should remain open, please let me know. |
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 |
Before opening, please confirm:
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v12.19.0
Amplify CLI Version
6.1.1
What operating system are you using?
Mac
Amplify Categories
api
Amplify Commands
add, codegen, push
Describe the bug
Issue
GraphQL Transform creates a different list query name in 6.1.1 as compared to 5.0.1.
As a developer, using Amplify.API from iOS, they are provided with builder methods to create the GraphQL requests:
This request is now failing with the latest CLI provisioning. The overall flow:
You can ignore most of the details here like the
@key
usage and the fields. They are from investigating the two issues: Developers following a tutorial from AWS and no longer works. AWS Tutorial. iOS Issue raised by Sebastien. Developer's Amplify.API list query fails. Developer calls out that they are using CLI 5.5.0: iOS Issueamplify add api
, choose API key for simplicity.amplify push
, thenamplify codegen models
Observed the list query names in AppSync console
with 5.0.1
type NoteData
-> query listNoteDatastype Wishes
-> query listWishesstype Wish
-> query listWishsThe resulting list query is observed to be generated as:
"list" + typeName + "s"
.Amplify iOS library aligns with this by having the same logic when generating the query name
with 6.1.1
type NoteData
-> query listNoteDatatype Wishes
-> query listWishestype Wish
-> query listWishesNotice that the logic
"list" + typeName + "s"
no longer holds true. We do havepluralName
of the type in the swift schema file after runningamplify codegen model
, so we can update this logic to"list" + pluralName"
to make it work.Note: If you try to provision the above input schema, you actually have do them separately because
type Wishes
andtype Wish
in one schema will fail since they generate the same name:Impact Discussion
1. New projects using latest CLI cannot use Amplify iOS library.
Amplify library needs an update that support the latest CLI version. From the investigation, I believe the library needs to use the
"list" + pluralName"
and the API calls will start working. Can you verify that this is the correct change to make by identifying the changes in CLI? Should there be a feature flag for this? One of the issues from the developer indicated that they were using CLI 5.5.0.Looks like #7258 ?
2. Existing developers cannot upgrade to a fixed version of the iOS library
The second problem with this issue is that the identified fix in the library cannot be written in a way that is backwards compatible for existing APIs.
amplify codegen models
process is not versioned. It doesn't indicate the CLI version in which it was generated with. For example, if it did, then we are able to abstract this upgrade away from developers to some logic that checks the CLI versionWithout the ability to be backwards compatible, developers have to upgrade iOS library with the fix and update the provisioned API (by upgrading the CLI and running
amplify push
) at the same time. This isn't at all that easy if there are not changes to the schema,amplify status
shows "No Change".3. Are other platforms affected?
Although the details are specific to iOS, you can imagine similar scenarios to other platforms. We should have an issue for each platform to verify this use case is still working or describe the details as to how it works differently from iOS and is not affected.
References
This issue is not related to #7817 since it's for the v2 transformer
The text was updated successfully, but these errors were encountered: