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): SerializedCustomType de/serialization #2350

Merged

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Mar 20, 2023

  • PR title and description conform to Pull Request guidelines.

Issue #, if available:

aws-amplify/amplify-flutter#2710

Description of changes:

The use cases of this changes are specific to amplify-flutter DataStore context, and are isolated from native amplify-android DataStore.

  1. Updated the SerializedCustomTypeAdapter used by Gson to allow include custom type schema and serialized data (exmaple) (this serialization process is used for saving pending mutation into PersistentRecord table of the local SQLite DB, when saving a model that has nested custom types but the device is offline)
  2. Updated the SerializedModelAdapter used by Gson to allow correctly serialize nested custom types
  3. Added getFlatSerializedData to SerializedCustomType to return pure data without serialized schema info (example)
  4. Added custom type field check and handling to SQLiteModelFieldTypeConverter to ensure correct custom type json value to be written into local database without serialized schema info

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.

@HuiSF HuiSF force-pushed the fix/datastore/serialized-custom-type branch 3 times, most recently from 259484c to 975c2d7 Compare March 22, 2023 19:10
@HuiSF HuiSF force-pushed the fix/datastore/serialized-custom-type branch from 975c2d7 to 4a08705 Compare March 22, 2023 19:30
@HuiSF HuiSF marked this pull request as ready for review March 22, 2023 21:20
@HuiSF HuiSF requested a review from a team as a code owner March 22, 2023 21:20
Copy link
Contributor

@manueliglesias manueliglesias left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@mattcreaser mattcreaser enabled auto-merge (squash) April 27, 2023 19:16
@mattcreaser mattcreaser merged commit 9987b9b into aws-amplify:main May 3, 2023
dnys1 pushed a commit that referenced this pull request Aug 3, 2023
Fixes: aws-amplify/amplify-flutter#3472, aws-amplify/amplify-flutter#3482

The issue of ser/deseralizing custom types was partially fixed by #2350. However, once this was released, customers quickly noticed new issues. The prior fix did not handle arrays of custom types which this PR addresses.
dnys1 pushed a commit that referenced this pull request Aug 3, 2023
Fixes: aws-amplify/amplify-flutter#3472, aws-amplify/amplify-flutter#3482

The issue of ser/deseralizing custom types was partially fixed by #2350. However, once this was released, customers quickly noticed new issues. The prior fix did not handle arrays of custom types which this PR addresses.
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.

3 participants