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
Thanks for creating amazing plugin!This plugin is so useful!
With global fragments turned on, I am using this plugin with query containing multiple fragments. However, sometimes query is not allowed because fragments definition order is not the same with documents other codegen plugins generate.(I confirmed typescript-graphql-request and typed-document-node does not generate code that works with allow lists this plugin generate)
This happened by difference of how to treat global fragments, so I think this can be solved by changing
allow lists and document are generated in folder name generated.
confirm GetBook query in allow list.(AuthorData appears before BookData)
- name: allowed-queriesdefinition:
queries:
- name: GetBookquery: |- query GetBook { book { ...BookData author { ...AuthorData } } } fragment AuthorData on Author { name books { ...BookData } } fragment BookData on Book { name }
6.confirm GetBookDocument generated by typed-document-node(AuthorData does not appear before BookData)
The text was updated successfully, but these errors were encountered:
shoma-mano
changed the title
hasura-allow-list:requiredFragmentNames order should be kepthasura-allow-list:not compatible with other plugins
Oct 5, 2023
Which packages are impacted by your issue?
@graphql-codegen/hasura-allow-list
Describe the bug
Thanks for creating amazing plugin!This plugin is so useful!
With global fragments turned on, I am using this plugin with query containing multiple fragments. However, sometimes query is not allowed because fragments definition order is not the same with documents other codegen plugins generate.(I confirmed typescript-graphql-request and typed-document-node does not generate code that works with allow lists this plugin generate)
This happened by difference of how to treat global fragments, so I think this can be solved by changing
graphql-code-generator-community/packages/plugins/other/hasura-allow-list/src/index.ts
Line 34 in 66b414e
to
Order of requiredFragmentNames should be kept.
Your Example Website or App
https://github.com/shoma-mano/hasura-allowlist-reproduction
Steps to Reproduce the Bug or Issue
6.confirm GetBookDocument generated by typed-document-node(AuthorData does not appear before BookData)
7.confirm GetBookDocument generated by typescript-graphql-request(AuthorData does not appear before BookData)
export const GetBookDocument = gql
query GetBook { book { ...BookData author { ...AuthorData } } } ${BookDataFragmentDoc} ${AuthorDataFragmentDoc}
;Expected behavior
compatible with other plugins.
Screenshots or Videos
No response
Platform
hasura
version: [2.34.0]@graphql-codegen/cli
version: [5.0.0]@graphql-codegen/hasura-allow-list
version: [3.0.0]Codegen Config File
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: