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

fix(v1): CPK has-many has-one associatedFields #2734

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

lawmicha
Copy link
Member

@lawmicha lawmicha commented Feb 2, 2023

Issue #

Table of contents

Description

This PR does not attempt to fix the uni-directional has-many lazy loading list issue, see #2730 for more details and the fix. Since the CPK codegen changes (aws-amplify/amplify-codegen#538 ) are available in v1, this PR introduces that parameter to make sure newly generated types continue to compile with the added associatedWithFields argument to hasMany model fields. When we are ready to move forward with the backport of #2711 then it will be solved on v1.

We are also fixing uni-directional has-one CPK use case by extending has-one with `associatedFields. Corresponding codegen changes are in aws-amplify/amplify-codegen#541

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lawmicha lawmicha requested a review from a team as a code owner February 2, 2023 21:20
@lawmicha lawmicha changed the title fix: CPK has-many targetNames fix(v1): CPK has-many targetNames Feb 2, 2023
@lawmicha lawmicha changed the title fix(v1): CPK has-many targetNames fix(v1): CPK has-many associatedWithFields Feb 2, 2023
@lawmicha lawmicha changed the title fix(v1): CPK has-many associatedWithFields fix(v1): CPK has-many associatedFields Feb 2, 2023
@lawmicha lawmicha force-pushed the v1.has-many-target-names branch 2 times, most recently from 764842d to 06b6bf4 Compare February 3, 2023 13:30
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2023

Codecov Report

Merging #2734 (fe29459) into v1 (9bf836c) will decrease coverage by 0.15%.
The diff coverage is 48.27%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##               v1    #2734      +/-   ##
==========================================
- Coverage   64.42%   64.28%   -0.15%     
==========================================
  Files         720      720              
  Lines       22722    22736      +14     
==========================================
- Hits        14639    14616      -23     
- Misses       8083     8120      +37     
Flag Coverage Δ
API_plugin_unit_test 66.78% <ø> (ø)
AWSPluginsCore 73.27% <100.00%> (-0.08%) ⬇️
Amplify 51.27% <42.30%> (-0.10%) ⬇️
Analytics_plugin_unit_test 72.43% <ø> (ø)
Auth_plugin_unit_test 83.88% <ø> (ø)
DataStore_plugin_unit_test 81.67% <100.00%> (-0.40%) ⬇️
Geo_plugin_unit_test 57.87% <ø> (ø)
Predictions_plugin_unit_test 33.61% <ø> (ø)
Storage_plugin_unit_test 59.55% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...Model/Internal/Schema/ModelSchema+Definition.swift 55.90% <0.00%> (-5.75%) ⬇️
...Model/Internal/Schema/ModelField+Association.swift 46.93% <100.00%> (+3.50%) ⬆️
...e/AWSPluginsCore/Model/Support/Model+GraphQL.swift 74.80% <100.00%> (ø)
...insCore/Model/Support/QueryPredicate+GraphQL.swift 74.63% <100.00%> (ø)
...goryPlugin/Storage/SQLite/ModelSchema+SQLite.swift 94.25% <100.00%> (ø)
...ingMutationQueue/OutgoingMutationQueue+State.swift 0.00% <0.00%> (-68.75%) ⬇️
...ngMutationQueue/OutgoingMutationQueue+Action.swift 0.00% <0.00%> (-66.67%) ⬇️
...e/AWSPluginsCore/Auth/AWSAuthServiceBehavior.swift 75.00% <0.00%> (-12.50%) ⬇️
...MutationQueue/OutgoingMutationQueue+Resolver.swift 82.14% <0.00%> (-10.72%) ⬇️
...s/AWSHubPlugin/Internal/HubChannelDispatcher.swift 94.11% <0.00%> (-2.95%) ⬇️
... and 2 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lawmicha lawmicha changed the title fix(v1): CPK has-many associatedFields fix(v1): CPK has-many/has-one associatedFields Feb 3, 2023
5d
5d previously approved these changes Feb 3, 2023
@lawmicha lawmicha changed the title fix(v1): CPK has-many/has-one associatedFields fix(v1): CPK has-many has-one associatedFields Feb 3, 2023
Copy link
Member

@5d 5d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lawmicha lawmicha merged commit c393d78 into v1 Feb 3, 2023
@lawmicha lawmicha deleted the v1.has-many-target-names branch February 3, 2023 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants