test: add a test to capture failed gql array coercion for nested pagination orderBy #594
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I believe that the nested pagination is not respecting the GraphQL list input coercion. I've added a test to demonstrate this. Note that the test passes if you change the nested input to
children(orderBy: [{direction: DESC, field: PRIORITY_ORDER}])
(ie pass the same argument as a single-element list toorderBy
).I believe this bug was introduced in #495 specifically in the method
fieldArgs
inentgql/template/collection.tmpl
. From my debugging, it appears thatgraphql.FieldContext.Args
contains a slice (ie already coerced), butgraphql.CollectedField.ArgumentMap()
contains the un-coerced input as a map.I would be happy to write a fix but I don't fully understand the implications of the pull request I referenced above, and I'm not sure why getting the args from the child field context was broken before. If getting the coerced args from the field context is not possible, my other suggestion is to add cases for non-slice types in the multiOrder branch here:
contrib/entgql/template/collection.tmpl
Line 213 in 5ae020b