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(datastore): Update Model Class Check in getMutationForModelId() from using ModelSchema class name to mutatedItem modelName #2637

Conversation

ankpshah
Copy link
Contributor

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:
#2608

Description of changes:

Change the model class comparison logic in getMutationForModelId() from
using getModelClass().getName() to directly using getName(). This
modification addresses an issue where requests from Flutter are
encapsulated within a Serialized model. Previously, getModelClass()
returned a fixed class name "com.amplifyframework.core.model.SerializedModel",
making it impossible to differentiate between various model classes
generating mutations. This update ensures accurate identification of
model class involved in mutation.

How did you test these changes?
(Please add a line here how the changes were tested)

Documentation update required?

  • No
  • Yes (Please include a PR link for the documentation update)

General Checklist

  • Added Unit Tests
  • Added Integration Tests
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)

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

…onfig

- The build process will fail when versions of explicitly allowed dependencies in the license check configuration are updated.

- This enforces a review of any updates in licenses before the changes can be merged.

- This enforcement does not apply to dependencies with already allowed license types and is only for explicitly allowed dependencies
…g/2608-same-primary-key-value-across-different-models-triggers-conflict

Merging main for latest changes
…ersistentRecords

Change the model class comparison logic in `getMutationForModelId()` from
using `getModelClass().getName()` to directly using `getName()`. This
modification addresses an issue where requests from Flutter are
encapsulated within a Serialized model. Previously, `getModelClass()`
returned a fixed class name "com.amplifyframework.core.model.SerializedModel",
making it impossible to differentiate between various model classes
generating mutations. This update ensures accurate identification of
model class involved in mutation.
…g/2608-same-primary-key-value-across-different-models-triggers-conflict

Sync with main branch
@ankpshah ankpshah requested a review from a team as a code owner November 15, 2023 19:52
@ankpshah ankpshah changed the title Bug/2608 same primary key value across different models triggers conflict fix(datastore): Update Model Class Check in getMutationForModelId() from using ModelSchema class name to mutatedItem modelName Nov 15, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2023

Codecov Report

Merging #2637 (effd1bd) into main (ebd8565) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2637   +/-   ##
=======================================
  Coverage   41.81%   41.81%           
=======================================
  Files         902      902           
  Lines       28996    28996           
  Branches     4107     4107           
=======================================
+ Hits        12125    12126    +1     
+ Misses      15543    15542    -1     
  Partials     1328     1328           

@tylerjroach tylerjroach mentioned this pull request Dec 14, 2023
2 tasks
@ankpshah ankpshah merged commit fc7205c into main Dec 14, 2023
4 checks passed
@ankpshah ankpshah deleted the bug/2608-same-primary-key-value-across-different-models-triggers-conflict branch December 14, 2023 16:58
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.

4 participants