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

🔧 Sort inputs alphabetically #35

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/@graphql-mesh/merger-stitching/cjs/index.js b/node_modules/@graphql-mesh/merger-stitching/cjs/index.js
index 381e473..951f14d 100644
index 381e473..8b6840d 100644
--- a/node_modules/@graphql-mesh/merger-stitching/cjs/index.js
+++ b/node_modules/@graphql-mesh/merger-stitching/cjs/index.js
@@ -1,5 +1,17 @@
Expand All @@ -20,7 +20,7 @@ index 381e473..951f14d 100644
const stitch_1 = require("@graphql-tools/stitch");
class StitchingMerger {
constructor(options) {
@@ -42,6 +54,12 @@ class StitchingMerger {
@@ -42,6 +54,19 @@ class StitchingMerger {
},
}),
});
Expand All @@ -29,6 +29,13 @@ index 381e473..951f14d 100644
+ Object.keys(unifiedSchema._typeMap).forEach((type) => {
+ unifiedSchema._typeMap[type]._fields = sortKeys(unifiedSchema._typeMap[type]._fields);
+ });
+ // Sort query and mutation inputs alphabetically
+ ['Query', 'Mutation'].forEach((operation) => {
+ const fields = unifiedSchema._typeMap[operation]._fields;
+ Object.keys(fields).filter((field) => fields[field].args).forEach((field) => {
+ fields[field].args.sort((a, b) => a.name.localeCompare(b.name));
+ });
+ });
+
return {
schema: unifiedSchema,
Expand Down
Loading