-
-
Notifications
You must be signed in to change notification settings - Fork 2
Extended test suite of 'typeWeightObject' to account for lists, enums, interfaces and unions #22
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
Conversation
…e typeWeightCOnfig object
shalarewicz
left a comment
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.
Great work! Left a few comments. We can discuss further if needed.
…he other lists of unknown size. Also added the function into the query field for lists wit arguments
jondeweydev
left a comment
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 wish I could add any insight, if we can find time to quickly talk through the code, perhaps I can add another perspective, but as of reading it now it looks thoughtful. I would recommend adding more comments to the code in the future
Summary
Changes are not 100% ready but I am requesting feedback and input on 1 particular problem I am having.
When working with lists in graphQL, the type complexity of the query is dependent on the number of objects returned in the list. For example, on
line 190inbuildTypeWeights.test.ts:'type Query { reviews(episode: Episode!, first: Int): [Review] }'the field reviews is a list, with the number of reviews included in the response dependent on the argument passed in for
first. Iffirstis 3 than the type complexity of the reviews field in the query is 3, since it returns 3 Review objects in the response. The challenge is how to represent this in thetypeWeightsObject(if it should be). I currently have the expected field weight for theReviewtype set to1. Maybe this is something the complexity algorithm should deal with since it knows the argument passed in tofirst?Type of Change
Issues
Evidence