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

feat(datastore): Add non-model type support for amplify-flutter #1459

Merged
merged 11 commits into from
Sep 9, 2021

Conversation

HuiSF
Copy link
Member

@HuiSF HuiSF commented Aug 23, 2021

Issue #, if available: amplify-flutter #260

Description of changes:

  • Make ModelSchemaRegistry support registering CustomType schemas
  • Make AppSync able to process GraphQL request for SerializedModel nesting SerializedCustomType
  • Make DataStore able to read/write with SerializedCustomType for amplify-flutter

Tasks

  • Rename ModelSchemaRegistry to SchemaRegistry
  • Implement CustomTypeSchema, SerializedCustomType and related classes
  • Implement additional logic to support serializing and deserializing with SerializedCustomType with amplify-flutter use cases
  • Add unit tests for code changes in aws-api-appsync
  • Add unit tests for code changes in aws-datastore
  • Add unit tests for code changes in core

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

@HuiSF HuiSF requested a review from a team August 23, 2021 17:11
Comment on lines +157 to +162
public static synchronized SchemaRegistry instance() {
if (SchemaRegistry.instance == null) {
SchemaRegistry.instance = new SchemaRegistry();
}

return SchemaRegistry.instance;
Copy link
Member Author

Choose a reason for hiding this comment

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

From this use case of SchemaRegistry, it looks like SchemaRegistry should be a singleton. The original code didn't work and didn't break either as the original logic wasn't really depending on retrieving a valid model schema.

@poojamat poojamat marked this pull request as draft August 23, 2021 19:09
@HuiSF HuiSF marked this pull request as ready for review September 2, 2021 18:45
@@ -28,7 +28,7 @@
import com.amplifyframework.core.model.ModelAssociation;
import com.amplifyframework.core.model.ModelField;
import com.amplifyframework.core.model.ModelSchema;
import com.amplifyframework.core.model.ModelSchemaRegistry;
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the rationale behind renaming this class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for asking :)
ModelSchemaRegistry not holds CustomTypeSchema as well, the original name was leading by Model which could be confusing, so updated to just SchemaRegistry.

* @param modelSchema schema for the Model object
* @param <T> type of the Model object.
* @param <T> type of the Model object.
Copy link
Member

Choose a reason for hiding this comment

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

nit: some of the formatting looks like it needs to be corrected

Copy link
Member Author

Choose a reason for hiding this comment

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

This formatting is automatically added by the IDE I think, which align parameter description block with each other for readability.

Copy link
Member

@Jordan-Nelson Jordan-Nelson left a comment

Choose a reason for hiding this comment

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

LGTM

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