Amplify-cli: Inconsistency with plurals in generated graphQL queries

Created on 5 May 2020  路  1Comment  路  Source: aws-amplify/amplify-cli

Describe the bug
minor issue where if for whatever reason you want to add an 's' to the end of a type name the generated graphql queries are not following the same behaviour for plurals.
e.g.

type Books @model {
   id: ID!
   desc: String
}

generates
type Query {
syncBooks()
getBooks()
listBookss()
}

Expected Behaviour
I think the Android Datastore SDK expects syncBookss same as listBookss

Amplify CLI Version
amplify 4.18.1

Desktop (please complete the following information):

  • OS: Mac
  • Node Version. v12.14.1
enhancement graphql-transformer

Most helpful comment

Thanks for reporting this. This issue was introduced in our older code where pluralization was done by appending s end the end of the model. The new sync resolvers does the pluralization correctly, but changing it for list query would break existing APIs. I am adding this to our backlog so we can do this without breaking the existing APIs.

For DataStore we do expose an additional parameter called pluralName which should be used for sync queries

https://github.com/aws-amplify/amplify-cli/blob/4e92402e0b0fae30501972f3ad16203fc19ba287/packages/amplify-codegen-appsync-model-plugin/src/__tests__/visitors/__snapshots__/appsync-java-visitor.test.ts.snap#L23

>All comments

Thanks for reporting this. This issue was introduced in our older code where pluralization was done by appending s end the end of the model. The new sync resolvers does the pluralization correctly, but changing it for list query would break existing APIs. I am adding this to our backlog so we can do this without breaking the existing APIs.

For DataStore we do expose an additional parameter called pluralName which should be used for sync queries

https://github.com/aws-amplify/amplify-cli/blob/4e92402e0b0fae30501972f3ad16203fc19ba287/packages/amplify-codegen-appsync-model-plugin/src/__tests__/visitors/__snapshots__/appsync-java-visitor.test.ts.snap#L23

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nason picture nason  路  3Comments

gabriel-wilkes picture gabriel-wilkes  路  3Comments

kangks picture kangks  路  3Comments

jexh picture jexh  路  3Comments

ReidWeb picture ReidWeb  路  3Comments