lighthouse
lighthouse copied to clipboard
Fix rehydration of subscription args with differing internal representations
- [x] Added or updated tests
- [ ] Documented user facing changes
- [ ] Updated CHANGELOG.md
Changes
Breaking changes
@stayallive opened the PR to see the results of the test run.
That's a tricky one.
We currently store the internal value of the ENUM
when serializing the subscription, which causes the rehydrated execution during the broadcast to fail. This might also be problematic when using custom scalar types whose internal representation might not be serializable.
I think we should try and get a hold of the raw args/variables that are passed during the initial subscription request and serialize exactly those. That will ensure the rehydrated requests function exactly the same.
Yeah was thinking the same, will brew a bit on this, thanks for the pointers 👍
That prettify docs shouldn't have ran here and or had any effect... that will mess up some PR's 😉
@stayallive a tricky part is that the raw request may contain literal argument values as well as variables. We don't ever see an intermediary representation where those are merged, but not cast to their internal values (e.g. Enum classes).
I dug in to graphql-php
and see if they expose this structure, or at least a method to build it from the raw request. Looks like there is no representation of raw, merged arguments: https://github.com/webonyx/graphql-php/blob/4f3430990824ff410fe548102cb85f0c46442704/src/Executor/ReferenceExecutor.php#L623-L627