Skip to content

Commit 0912c06

Browse files
committed
BREAKING: remove sorting by name from printSchema
1 parent bf39198 commit 0912c06

File tree

2 files changed

+1
-57
lines changed

2 files changed

+1
-57
lines changed

src/utilities/schemaPrinter.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,7 @@ function printFilteredSchema(
8686
): string {
8787
const directives = schema.getDirectives().filter(directiveFilter);
8888
const typeMap = schema.getTypeMap();
89-
const types = objectValues(typeMap)
90-
.sort((type1, type2) => {
91-
if (isMutationType(schema, type1)) return -1;
92-
if (isQueryType(schema, type1)) return -1;
93-
if (isSubscriptionType(schema, type1)) return -1;
94-
95-
return type1.name.localeCompare(type2.name);
96-
})
97-
.filter(typeFilter);
89+
const types = objectValues(typeMap).filter(typeFilter);
9890

9991
return (
10092
[printSchemaDefinition(schema)]

src/utilities/typeComparators.js

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -120,51 +120,3 @@ export function doTypesOverlap(
120120
// Otherwise the types do not overlap.
121121
return false;
122122
}
123-
124-
/**
125-
* Checks if type is query
126-
*
127-
* @internal
128-
*/
129-
export function isQueryType(schema: GraphQLSchema, type: GraphQLCompositeType) {
130-
const schemaType = schema.getQueryType();
131-
if (schemaType) {
132-
return schemaType.name === type.name;
133-
}
134-
135-
return false;
136-
}
137-
138-
/**
139-
* Checks if type is mutation
140-
*
141-
* @internal
142-
*/
143-
export function isMutationType(
144-
schema: GraphQLSchema,
145-
type: GraphQLCompositeType,
146-
) {
147-
const schemaType = schema.getMutationType();
148-
if (schemaType) {
149-
return schemaType.name === type.name;
150-
}
151-
152-
return false;
153-
}
154-
155-
/**
156-
* Checks if type is subscription
157-
*
158-
* @internal
159-
*/
160-
export function isSubscriptionType(
161-
schema: GraphQLSchema,
162-
type: GraphQLCompositeType,
163-
) {
164-
const schemaType = schema.getSubscriptionType();
165-
if (schemaType) {
166-
return schemaType.name === type.name;
167-
}
168-
169-
return false;
170-
}

0 commit comments

Comments
 (0)