Skip to content

Commit 73d8fee

Browse files
committed
BREAKING: remove sorting by name from printSchema
1 parent f6a4938 commit 73d8fee

File tree

2 files changed

+1
-58
lines changed

2 files changed

+1
-58
lines changed

src/utilities/schemaPrinter.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ import {
3333
} from '../type/definition';
3434

3535
import { astFromValue } from '../utilities/astFromValue';
36-
import { isMutationType } from './typeComparators';
37-
import { isQueryType } from './typeComparators';
38-
import { isSubscriptionType } from './typeComparators';
3936

4037
type Options = {|
4138
/**
@@ -90,13 +87,7 @@ function printFilteredSchema(
9087
const directives = schema.getDirectives().filter(directiveFilter);
9188
const typeMap = schema.getTypeMap();
9289
const types = objectValues(typeMap)
93-
.sort((type1, type2) => {
94-
if (isMutationType(schema, type1)) return -1;
95-
if (isQueryType(schema, type1)) return -1;
96-
if (isSubscriptionType(schema, type1)) return -1;
9790

98-
return type1.name.localeCompare(type2.name);
99-
})
10091
.filter(typeFilter);
10192

10293
return (

src/utilities/typeComparators.js

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -119,52 +119,4 @@ export function doTypesOverlap(
119119

120120
// Otherwise the types do not overlap.
121121
return false;
122-
}
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-
}
122+
}

0 commit comments

Comments
 (0)