-
Notifications
You must be signed in to change notification settings - Fork 199
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
Remove dependency on ModelRegistry for syncability of models #252
Conversation
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.
My read on this is that syncability is an internal concept, which seems appropriate. The way we're representing it seems odd to me--why do some types have separate "Sync" flavors, while others are extended by virtue of an incoming boolean parameter? I'd like us to think a little more about this to see if this is the right way to model it. But as an incremental change to enable the functionality for now, LGTM.
@@ -48,12 +48,17 @@ class GraphQLSyncBasedTests: XCTestCase { | |||
let uuid = UUID().uuidString | |||
let testMethodName = String("\(#function)".dropLast(2)) | |||
let title = testMethodName + "Title" | |||
guard let post = createPost(id: uuid, title: title) else { | |||
guard let createMutation = createPost(id: uuid, title: title) else { |
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.
Is createPost
creating a Post model or a CreatePost mutation? Please align the names appropriately
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.
updating to createdPost
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.
Also okay with pushing this in.. we can talk about the interface for subscribe at a later time
|
||
public init(of modelType: Model.Type, | ||
type subscriptionType: GraphQLSubscriptionType) { | ||
type subscriptionType: GraphQLSubscriptionType, | ||
syncEnabled: Bool = false) { |
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.
I'm not sure if it makes sense to expose a syncEnabled flag for this class, right? Seems like if we have a subscription with a model, syncEnabled has to be true, right?
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.
a backend can be provisioned with/without sync so the graphql document can be constructed with sync related fields or without by using this syncEnabled
parameter
Yes I agree, it is odd that there are specific types to build in the sync fields and then there are types that just take in the syncEnabled parameter. I can see these types getting another overhaul, especially with the @auth directive. |
e437ec0
to
fcc497a
Compare
…ction set. This introduces a flag for whether a GraphQLDocument helper method should contain the sync-able fields. Methods like GraphQLSyncQuery by default will be true, and methods like GraphQLGetQuery can be used with syncEnabled parameter.
fcc497a
to
f3b683c
Compare
Major changes
This introduces a flag for whether a GraphQLDocument helper method should contain the sync-able fields. Methods like GraphQLSyncQuery by default will be true, and methods like GraphQLGetQuery can be used with syncEnabled parameter.
Minor changes
Testing done
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.