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
packages/documents/tests/print-executable-graphql-document.spec.ts add the following test:
test('should not sort a mutation as mutations run in series and order matters', () => {
const inputDocument = parse(/* GraphQL */ mutation A { c { f e d } b a });
const outputStr = printExecutableGraphQLDocument(inputDocument);
expect(outputStr).toMatchInlineSnapshot("mutation A { c { f e d } b a }");
});
Expected behavior
Mutations not to be sorted
Environment:
OS: MacOS
"@graphql-tools/documents@^1.0.0"::
NodeJS: LTS Iron (v20) - Now using node v20.12.2 (npm v10.5.0)
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Describe the bug
printExecutableGraphQLDocument sorts mutations by name whereas from the GraphQL spec the order of mutation matters, they do not run in parallel like queries, but in series. See: https://graphql.org/learn/queries/#multiple-fields-in-mutations
To Reproduce Steps to reproduce the behavior:
packages/documents/tests/print-executable-graphql-document.spec.ts
add the following test:test('should not sort a mutation as mutations run in series and order matters', () => {
const inputDocument = parse(/* GraphQL */
mutation A { c { f e d } b a }
);const outputStr = printExecutableGraphQLDocument(inputDocument);
expect(outputStr).toMatchInlineSnapshot(
"mutation A { c { f e d } b a }"
);});
Expected behavior
Mutations not to be sorted
Environment:
"@graphql-tools/documents@^1.0.0":
:Additional context
Linked issue in graphql-code-generator: dotansimha/graphql-code-generator#9925
PR I made to graphql-code-generator to provide an alternative: dotansimha/graphql-code-generator#9926 - here I was asked to create a PR here ;)
Creating a PR here now
The text was updated successfully, but these errors were encountered: