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
The lexicographicSortSchema function currently sorts both the top level types and the internal types of the provided schema. This has created an issue with code generation for me because the order of my graphql enums is being sorted which has a runtime impact on my code.
I would like to propose an optional parameter to this function which disables this "deep" sorting, instead only sorting the top level declarations.
@kbrooks The purpose of lexicographicSortSchema is to sort everything is much as possible.
If you want to sort just top-level types, this can be done easily:
const schemaConfig = schema.toConfig();
const sortedSchema = new GraphQLSchema({
...schemaConfig,
types: [...schemaConfig.types].sort((a, b) => a.name.localeCompare(b.name)),
});
The lexicographicSortSchema function currently sorts both the top level types and the internal types of the provided schema. This has created an issue with code generation for me because the order of my graphql enums is being sorted which has a runtime impact on my code.
I would like to propose an optional parameter to this function which disables this "deep" sorting, instead only sorting the top level declarations.
dotansimha/graphql-code-generator#6935
The text was updated successfully, but these errors were encountered: