Skip to content

Commit 632a742

Browse files
committed
Update printSchema for recent SDL change to implements.
Added test to prevent future regressions. Updated existing also.
1 parent fd4a69c commit 632a742

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/utilities/__tests__/extendSchema-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ describe('extendSchema', () => {
697697
fizz: String
698698
}
699699
700-
type Foo implements SomeInterface, NewInterface {
700+
type Foo implements SomeInterface & NewInterface {
701701
name: String
702702
some: SomeInterface
703703
tree: [Foo]!
@@ -761,7 +761,7 @@ describe('extendSchema', () => {
761761
foo: Foo
762762
}
763763
764-
type Biz implements NewInterface, SomeInterface {
764+
type Biz implements NewInterface & SomeInterface {
765765
fizz: String
766766
buzz: String
767767
name: String

src/utilities/__tests__/schemaPrinter-test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { describe, it } from 'mocha';
99
import { expect } from 'chai';
1010
import dedent from '../../jsutils/dedent';
1111
import { printSchema, printIntrospectionSchema } from '../schemaPrinter';
12+
import { buildSchema } from '../buildASTSchema';
1213
import {
1314
GraphQLSchema,
1415
GraphQLInputObjectType,
@@ -27,7 +28,10 @@ import { GraphQLDirective } from '../../type/directives';
2728
import { DirectiveLocation } from '../../language/directiveLocation';
2829

2930
function printForTest(schema) {
30-
return printSchema(schema);
31+
const schemaText = printSchema(schema);
32+
// keep printSchema and buildSchema in sync
33+
expect(printSchema(buildSchema(schemaText))).to.equal(schemaText);
34+
return schemaText;
3135
}
3236

3337
function printSingleFieldSchema(fieldConfig) {
@@ -388,7 +392,7 @@ describe('Type System Printer', () => {
388392
int: Int
389393
}
390394
391-
type Bar implements Foo, Baaz {
395+
type Bar implements Foo & Baaz {
392396
str: String
393397
int: Int
394398
}

src/utilities/schemaPrinter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function printScalar(type: GraphQLScalarType, options): string {
176176
function printObject(type: GraphQLObjectType, options): string {
177177
const interfaces = type.getInterfaces();
178178
const implementedInterfaces = interfaces.length
179-
? ' implements ' + interfaces.map(i => i.name).join(', ')
179+
? ' implements ' + interfaces.map(i => i.name).join(' & ')
180180
: '';
181181
return (
182182
printDescription(options, type) +

0 commit comments

Comments
 (0)