You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In particular, graphql-jit adds a null-valued property for a parameter whose corresponding variable is missing, whereas graphql-js omits the property for which the variable is missing. Note that if we pass id1 and id2 as optional parameters to the mutation directly, both graphql-js and graphql-jit will only pass id1 to the resolver.
Thus, it looks like, for a required object-valued parameter whose properties are optional, graphql-jit will pass to the resolver an object with all properties set (nulls for absent properties), whereas graphql-js will pass to the resolver an object with properties omitted for those that are missing values among the variables.
Would it be possible to modify graphql-jit to also strip missing properties the same way that graphql-js does?
The text was updated successfully, but these errors were encountered:
Would it be possible to modify graphql-jit to also strip missing properties the same way that graphql-js does?
the way how graphql-js and graphql-jit work are different. graphql-jit compiles query ahead of execution and during compilation time we don't know if variable would be present or not when you actually run the query. without that context, we can't remove variable.
Consider the following code:
The parameters passed to the resolver differ as seen from the output:
In particular, graphql-jit adds a null-valued property for a parameter whose corresponding variable is missing, whereas graphql-js omits the property for which the variable is missing. Note that if we pass
id1
andid2
as optional parameters to the mutation directly, both graphql-js and graphql-jit will only passid1
to the resolver.Thus, it looks like, for a required object-valued parameter whose properties are optional, graphql-jit will pass to the resolver an object with all properties set (nulls for absent properties), whereas graphql-js will pass to the resolver an object with properties omitted for those that are missing values among the variables.
Would it be possible to modify graphql-jit to also strip missing properties the same way that graphql-js does?
The text was updated successfully, but these errors were encountered: