Skip to content

Commit

Permalink
Update printSchema for recent SDL change to implements. (#1179)
Browse files Browse the repository at this point in the history
Added test to prevent future regressions. Updated existing also.
  • Loading branch information
mohawk2 authored and leebyron committed Jan 8, 2018
1 parent 652c032 commit 802e518
Show file tree
Hide file tree
Showing 3 changed files with 9 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
8 changes: 6 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,10 @@ import { GraphQLDirective } from '../../type/directives';
import { DirectiveLocation } from '../../language/directiveLocation';

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

function printSingleFieldSchema(fieldConfig) {
Expand Down Expand Up @@ -404,7 +408,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 802e518

Please sign in to comment.