Skip to content
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

test: add a test to capture failed gql array coercion for nested pagination orderBy #594

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matt-silo
Copy link

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 to orderBy).

I believe this bug was introduced in #495 specifically in the method fieldArgs in entgql/template/collection.tmpl. From my debugging, it appears that graphql.FieldContext.Args contains a slice (ie already coerced), but graphql.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:

{{- if $multiOrder }}
I'm happy to add this if you think it makes sense and would accept such a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant