-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix TypeInfo.getInputType() for custom scalar list literals. #4518
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
base: 16.x.x
Are you sure you want to change the base?
Conversation
Fix graphql#4512. Also improves test coverage of TypeInfo and the affected validation rule. See linked issue.
|
@yuchenshi is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
|
It does seem like the Fixing this does seem to unlock allowing embedding variables inside list literals in positions expecting custom scalars (although only validation demonstrated here). We do allow embedding variables inside object literals within a position expecting a custom scalars, although that is currently non-specified, but supported behavior within graphql-js, and has been for a long time. I am not sure why historically we do not currently support allowing variables within list literals passed to custom scalars, as there would seem to be a reasonable parallel there, but I am a bit wary about introducing further non-specified behavior into the implementation without broader discussion from the WG. @graphql/tsc any thoughts on this? |
|
Ah, I see there is a linked issue basically giving the go ahead from @benjie => i would consider this a bug fix/feature rather than a breaking change, no existing queries will become invalid. |
|
That was the go ahead to essentially investigate/suggest a fix, not the go ahead to merge… just for clarity. Will review in more detail in the new year. Thanks for your work on this, both! |
|
One concern here is lists have fun behaviours in GraphQL; we do auto coercion of value to list (i.e. you can feed |
|
Either way, the literal behaviour ought to match the value behaviour. If we accept a list value for a custom scalar but not a list literal then that’s inconsistent and we should figure out what the correct behaviour should be. V17 is a good opportunity to introduce that fix. |
|
@yuchenshi based on the above comment from @benjie, this would be deferred until v17, which currently corresponds to the Also, a non-emergent reminder re: the CLA. |
Good point, let me see how I can add a test for this.
Re: what the correct behavior should be, will this be addressed under graphql/graphql-spec#1156 and/or graphql/graphql-spec#1179 ? Does either of these block this PR or the v17 release?
Let me rebase the PR then. Is there a target date for the v17 release? The linked bug is affecting us in production and even a ballpark estimation helps. I understand this repo doesn't have a fixed release schedule -- I just want to understand if we're quite close to v17 or it's more like months away.
I'm working with my employer on the CLA and I'll try to get it done before v17. |
Fix #4512.
Also improves test coverage of TypeInfo and the affected validation rule. See linked issue.
I've noticed an interesting existing behavior: When traversing a list literal,
TypeInfo.getInputType()returns the list element type duringenter(ListValue). As opposed to, the list type (such as[String]), as some may expect. I've add a comment to document this behavior. I'm assuming we don't want to introduce a breaking change here but a maintainer can let me know if we should treat it as a bug.The two
list literaltests would have been broken without the fix. Other tests are added purely for extra coverage as I don't want to break things as I fix others.