Skip to content

Navigation Menu

Sign in
Sign up

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

Open
matt-silo wants to merge 1 commit into
ent:master from
matt-silo:nested-pagination-order-array-coercion
Open

test: add a test to capture failed gql array coercion for nested pagination orderBy #594
matt-silo wants to merge 1 commit into
ent:master from
matt-silo:nested-pagination-order-array-coercion

Conversation

@matt-silo

@matt-silo matt-silo commented Jul 16, 2024

Copy link
Copy Markdown

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.

rszalski reacted with thumbs up emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /