Skip to content
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

automatically generated code is diffrent from API, AppSync and DataStore #1841

Closed
bjg2327 opened this issue Jun 1, 2022 · 5 comments
Closed
Labels
bug Something isn't working datastore Issues related to the DataStore category

Comments

@bjg2327
Copy link

bjg2327 commented Jun 1, 2022

Describe the bug

I have generated a model named EventNews.
But I'm getting an error in getList.
There is no problem with AWS AppSync Console and DataStore.

an error

Got failed result with GraphQL service returned a successful response containing errors: [Amplify.GraphQLError(messagee: "Validation error of type FieldUndefined: 'listEventNewss'\ in type 'Query'\ is undefined @'listEventNewss'", locations: Optional([Amplify.GraphQLError.Location(line: 2, column: 3)]), path: nil, extensions: nil)]

This problem seems to be due to the naming process

listEventNewss

// Code that causes an error
Amplify.API.query(request: .paginatedList(EventNews.self, limit: 100)
    .resultPublisher
    .sink { if case let .failure(error) = $0 { print("Got failed event with error \(error)") } }
    receiveValue: { result in
        switch result {
            case .success
            ...
           case .failure(let error):
               print("Got failed result with \(error.errorDescription)") // <-- Here
   }

// No problem with DataStore
Amplify.DataStore.query(EventNews.self)
   ...
// AWS AppSync Console
query MyQuery {
  listEventNews {
    items {
      id
    }
  }
}

Steps To Reproduce

1. Generate Model 'EventNews'

2. do Query
Amplify.API.query(request: .paginatedList(EventNews.self, limit: 100)

Expected behavior

Getting the list successfully

Amplify Framework Version

1.26.0

Amplify Categories

API

Dependency manager

Swift PM

Swift version

5.6

CLI version

8.3.1

Xcode version

13.3.1

Relevant log output

No response

Is this a regression?

No

Regression additional context

No response

Device

iPhone 12 - Simulator

iOS Version

15.4

Specific to simulators

No response

Additional context

No response

@atierian atierian added api Issues related to the API category datastore Issues related to the DataStore category pending-triage Issue is pending triage bug Something isn't working labels Jun 1, 2022
@ruisebas
Copy link
Member

ruisebas commented Jun 1, 2022

Thanks for opening this, @bjg2327. We will take a look and get back to you.

@lawmicha
Copy link
Member

lawmicha commented Jun 3, 2022

Hi @bjg2327, could you provide us with the contents of your amplify/cli.json file from the amplify cli project? specifically improvepluralization, useexperimentalpipelinedtransformer, and transformerversion.

// Example
{
  "features": {
    "graphqltransformer": {
      "addmissingownerfields": true,
      "improvepluralization": false, // this value
      "validatetypenamereservedwords": true,
      "useexperimentalpipelinedtransformer": true, // this value
      "enableiterativegsiupdates": true,
      "secondarykeyasgsi": true,
      "skipoverridemutationinputtypes": true,
      "transformerversion": 2, // this value
      "suppressschemamigrationprompt": true,
      "securityenhancementnotification": false,
      "showfieldauthnotification": false
    },
...

There seems to be some regression happening, which i was able to reproduce here #1707 (comment)

Once this aws-amplify/amplify-codegen#255 is released, you can upgrade to the latest CLI and it will generate those fields for you automatically.

@lawmicha lawmicha added pending-community-response Issue is pending response from the issue requestor and removed pending-triage Issue is pending triage labels Jun 3, 2022
@bjg2327
Copy link
Author

bjg2327 commented Jun 3, 2022

Hi @lawmicha
Code Here

"features": {
    "addmissingownerfields": true,
    "improvepluralization": false,
    "validatetypenamereservedwords": true,
    "useexperimentalpipelinedtransformer": true, 
    "enableiterativegsiupdates": true,
    "secondarykeyasgsi": true,
    "skipoverridemutationinputtypes": true,
    "transformerversion": 2,
    "suppressschemamigrationprompt": true,
    "securityenhancementnotification": false,
    "showfieldauthnotification": false
}
...

Once this aws-amplify/amplify-codegen#255 is released, you can upgrade to the latest CLI and it will generate those fields for you automatically.

Thank you for answering

@undefobj undefobj added the p2 label Jun 6, 2022
@lawmicha lawmicha added pending-release Code has been merged but pending release Code has been merged but pending release and removed pending-community-response Issue is pending response from the issue requestor labels Jun 8, 2022
@phantumcode phantumcode removed the api Issues related to the API category label Jul 24, 2023
@lawmicha
Copy link
Member

Please track #3135

@github-actions github-actions bot removed the pending-release Code has been merged but pending release Code has been merged but pending release label Aug 10, 2023
@lawmicha
Copy link
Member

lawmicha commented Sep 8, 2023

Please use Amplify CLI 12.4.0 or greater to get the fix for the pluralization issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore Issues related to the DataStore category
Projects
None yet
Development

No branches or pull requests

6 participants