Skip to content

Commit 3c79bed

Browse files
buildClientSchema: Revert breaking change introduced in #1677 (#1808)
More details here: 183ff32#r32971387
1 parent f289555 commit 3c79bed

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/utilities/__tests__/buildClientSchema-test.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,27 @@ function cycleIntrospection(sdlString) {
3838
const serverSchema = buildSchema(sdlString);
3939
const initialIntrospection = introspectionFromSchema(serverSchema);
4040
const clientSchema = buildClientSchema(initialIntrospection);
41+
const secondIntrospection = introspectionFromSchema(clientSchema);
42+
43+
hackToRemoveStandardTypes(secondIntrospection);
44+
hackToRemoveStandardTypes(initialIntrospection);
4145

4246
/**
4347
* If the client then runs the introspection query against the client-side
4448
* schema, it should get a result identical to what was returned by the server
4549
*/
46-
const secondIntrospection = introspectionFromSchema(clientSchema);
4750
expect(secondIntrospection).to.deep.equal(initialIntrospection);
48-
4951
return printSchema(clientSchema);
5052
}
5153

54+
// Temporary hack to remove always presented standard types should be removed in 15.0
55+
function hackToRemoveStandardTypes(introspection) {
56+
(introspection.__schema: any).types = introspection.__schema.types.filter(
57+
({ name }) =>
58+
['ID', 'Float', 'Int', 'Boolean', 'String'].indexOf(name) === -1,
59+
);
60+
}
61+
5262
describe('Type System: build schema from introspection', () => {
5363
it('builds a simple schema', () => {
5464
const sdl = dedent`
@@ -320,6 +330,9 @@ describe('Type System: build schema from introspection', () => {
320330
const introspection = introspectionFromSchema(schema);
321331
const clientSchema = buildClientSchema(introspection);
322332
const secondIntrospection = introspectionFromSchema(clientSchema);
333+
334+
hackToRemoveStandardTypes(secondIntrospection);
335+
hackToRemoveStandardTypes(introspection);
323336
expect(secondIntrospection).to.deep.equal(introspection);
324337

325338
const clientFoodEnum = clientSchema.getType('Food');

src/utilities/buildClientSchema.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ export function buildClientSchema(
9292
);
9393

9494
for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) {
95-
if (typeMap[stdType.name]) {
96-
typeMap[stdType.name] = stdType;
97-
}
95+
typeMap[stdType.name] = stdType;
9896
}
9997

10098
// Get the root Query, Mutation, and Subscription types.

0 commit comments

Comments
 (0)