hasura-allow-list has differing fragment order from apollo-codegen
Opened this issue · 0 comments
msiegenthaler commented
Which packages are impacted by your issue?
@graphql-codegen/hasura-allow-list
Describe the bug
When generating the allow list the order for fragments that depend on each other differs from what the apollo plugin generates. This means that the queries that are send are not in the allow list (hasura compares literal).
I run with globalFragments: true
and fragmentsOrder: "document"
.
Your Example Website or App
Steps to Reproduce the Bug or Issue
run the newly added test in the PR
Expected behavior
order of fragments respects dependencies between fragements
fragment A {
...B
}
must come after fragment B declaration
Screenshots or Videos
No response
Platform
- OS: macos
- NodeJS: 22.9.0
- graphql version: 16.8.1
- @graphql-codegen/cli: 5.0.0
- @graphql-codegen/client-preset: 4.1.0
- HEAD of this repo
Codegen Config File
import {CodegenConfig} from "@graphql-codegen/cli"
const config: CodegenConfig = {
overwrite: true,
schema: [
{
"http://localhost/v1/graphql": ... },
},
],
documents: [
"src/**/*.ts",
"src/**/*.tsx",
],
generates: {
"src/gql/": {
preset: "client",
presetConfig: {
fragmentMasking: false,
},
config: {
avoidOptionals: {
field: true,
object: true,
defaultValue: false,
input: false,
},
immutableTypes: true,
},
},
"allow_list.yaml": {
plugins: ["hasura-allow-list"],
config: {
globalFragments: true,
fragmentsOrder: "document",
},
},
},
}
export default config
Additional context
No response