-
Notifications
You must be signed in to change notification settings - Fork 825
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
fix(graphql-transformer-common): improve generated graphql pluralization #7258
fix(graphql-transformer-common): improve generated graphql pluralization #7258
Conversation
Thanks for the feedback! I updated the pull request to put this change behind a feature flag. Unfortunately, since the |
@johnpc You can add the FeatureFlag when creating an instance of GraphQL Transform. Example below: amplify-cli/packages/graphql-transformers-e2e-tests/src/__tests__/KeyTransformerLocal.e2e.test.ts Lines 329 to 337 in cda63df
|
does that apply to all the test files where I added the mock? Some of these files don't explicitly instantiate a |
Codecov Report
@@ Coverage Diff @@
## master #7258 +/- ##
==========================================
+ Coverage 52.72% 52.74% +0.02%
==========================================
Files 513 513
Lines 25914 25917 +3
Branches 5058 5059 +1
==========================================
+ Hits 13662 13669 +7
+ Misses 11286 11282 -4
Partials 966 966
Continue to review full report at Codecov.
|
This commit adds the `pluralize` npm library instead of blindly appending an "s" to acheive pluralization. For example, a model named "Match" should pluralize to "Matches", but before this commit Amplify would pluralize it to "Matchs" fix #4224
Reverting this PR as it appears to be causing a couple of e2e tests to fail: https://app.circleci.com/pipelines/github/aws-amplify/amplify-cli/1120/workflows/28f71966-47f4-476a-98da-a368a4bd69c3 |
👋 Hi, this pull request was referenced in the v5.0.2 release! Check out the release notes here https://github.com/aws-amplify/amplify-cli/releases/tag/v5.0.2. |
👋 Hi, this pull request was referenced in the v5.1.0 release! Check out the release notes here https://github.com/aws-amplify/amplify-cli/releases/tag/v5.1.0. |
…ion (aws-amplify#7258) This commit adds the `pluralize` npm library instead of blindly appending an "s" to acheive pluralization. For example, a model named "Match" should pluralize to "Matches", but before this commit Amplify would pluralize it to "Matchs" fix aws-amplify#4224
name: 'improvePluralization', | ||
type: 'boolean', | ||
defaultValueForExistingProjects: false, | ||
defaultValueForNewProjects: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we set the flag to true for new projects, they immediately won't work with the existing iOS library. This is a breaking change, right?
before:
type Wish
generateslistWishs
type Wishes
generateslistWishess
after:
type Wish
generateslistWishes
type Wishes
generateslistWishes
How do new projects work with existing iOS library? (investigating in #8350) Is it because iOS library has logic coupled to how the name is generated, and shoudn't have in the first place? Should we have feature flags for the libraries as well?
Description of changes
This commit adds the
pluralize
npm library instead of blindly appending an "s" to acheivepluralization. For example, a model named "Match" should pluralize to "Matches", but before this
commit Amplify would pluralize it to "Matchs"
Issue #, if available
This PR fixes #4224
It's worth noting that another pull request (#7030) was created to solve the same issue. However, multiple comments were left with suggestions to fix, and the author of the PR hasn't pushed out an update for a few weeks.
Additionally, that PR as written only solves the problem for models that end in an "s" or are otherwise already plural. It did not solve the issue in my case (the "Match" model being pluralized to "Matchs").
It's worth noting that pr #7030 also updated
.circleci/config.yml
. I couldn't figure out why that change was necessary. If it is, please let me know and I'll add it here.Description of how you validated changes
amplify-dev
cli with previously incorrectly pluralized model names (Tomatoes
andMatch
)Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.