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
add lexicographical sorting rules for schema stitching support (#256)
* fix sorting to be lexicographical
In larger projects, GraphQL schema stitching is a standardized practice. When stitching, Query, Mutation, and Subscription types are not always merged together sorted. [graphql-js has provided a function lexicographicSortSchema](graphql/graphql-js#2036) to enable stitched schemas to be sorted at runtime. Originally, this library used default JS sorting which is alphabetical. This makes the alphabetical rules virtually unusable by larger projects.
* introduce new listIsLexicographical function
Rather than a breaking change, I'm proposing new rules as a feature. :)
* add lexicographical versions of alphabetical rules
alphabetical !== lexicographical in JS. Let's just support both from this lib for backwards compatibility reasons.
* udpate README.md
* add rulesOptions to configuration
* update expect helpers to take configurationOptions
* update listIsAlphabetical to support lexicographical order
* remove lexicographic rules and update alphabetical rules to use sortOrder config option
* update README.md and runner
'only the rules specified will be used to validate the schema. Example: fields-have-descriptions,types-have-descriptions'
16
16
)
17
+
.option(
18
+
'-o, --rules-options <rulesOptions>',
19
+
'configure the specified rules with the passed in configuration options. example: {"enum-values-sorted-alphabetically":{"sortOrder":"lexicographical"}}'
20
+
)
17
21
.option(
18
22
'-i, --ignore <ignore list>',
19
23
"ignore errors for specific schema members, example: {'fields-have-descriptions':['Obvious','Query.obvious','Query.something.obvious']}"
@@ -152,6 +156,10 @@ function getOptionsFromCommander(commander) {
0 commit comments