Skip to content

Commit

Permalink
Update printSchema for recent SDL change to implements.
Browse files Browse the repository at this point in the history
Added test to prevent future regressions. Updated existing also.
  • Loading branch information
mohawk2 committed Dec 25, 2017
1 parent fd4a69c commit ba968da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/utilities/__tests__/extendSchema-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ describe('extendSchema', () => {
fizz: String
}
type Foo implements SomeInterface, NewInterface {
type Foo implements SomeInterface & NewInterface {
name: String
some: SomeInterface
tree: [Foo]!
Expand Down Expand Up @@ -761,7 +761,7 @@ describe('extendSchema', () => {
foo: Foo
}
type Biz implements NewInterface, SomeInterface {
type Biz implements NewInterface & SomeInterface {
fizz: String
buzz: String
name: String
Expand Down
7 changes: 5 additions & 2 deletions src/utilities/__tests__/schemaPrinter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { describe, it } from 'mocha';
import { expect } from 'chai';
import dedent from '../../jsutils/dedent';
import { printSchema, printIntrospectionSchema } from '../schemaPrinter';
import { buildSchema } from '../buildASTSchema';
import {
GraphQLSchema,
GraphQLInputObjectType,
Expand All @@ -27,7 +28,9 @@ import { GraphQLDirective } from '../../type/directives';
import { DirectiveLocation } from '../../language/directiveLocation';

function printForTest(schema) {
return printSchema(schema);
const schemaText = printSchema(schema);
buildSchema(schemaText); // keep printSchema and buildSchema in sync
return schemaText;
}

function printSingleFieldSchema(fieldConfig) {
Expand Down Expand Up @@ -388,7 +391,7 @@ describe('Type System Printer', () => {
int: Int
}
type Bar implements Foo, Baaz {
type Bar implements Foo & Baaz {
str: String
int: Int
}
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/schemaPrinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function printScalar(type: GraphQLScalarType, options): string {
function printObject(type: GraphQLObjectType, options): string {
const interfaces = type.getInterfaces();
const implementedInterfaces = interfaces.length
? ' implements ' + interfaces.map(i => i.name).join(', ')
? ' implements ' + interfaces.map(i => i.name).join(' & ')
: '';
return (
printDescription(options, type) +
Expand Down

0 comments on commit ba968da

Please sign in to comment.