Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- `apollo-env`
- <First `apollo-env` related entry goes here>
- `apollo-graphql`
- <First `apollo-graphql` related entry goes here>
- Add support for interface on interfaces to transformSchema. [PR #2456](https://github.com/apollographql/apollo-tooling/pull/2456)
- `apollo-language-server`
- <First `apollo-language-server` related entry goes here>
- `apollo-tools`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,27 @@ describe("transformSchema", () => {

# https://github.com/apollographql/apollo-tooling/issues/2162
directive @test(baz: DirectiveArg) on FIELD_DEFINITION

interface FooInterface {
foo: String
}

interface BarInterface implements FooInterface {
foo: String
bar: Boolean
}

type FooBarBazType implements FooInterface & BarInterface {
foo: String
bar: Boolean
baz: Float
}
`);

const originalSDL = printSchema(schema);
const newSchema = transformSchema(schema, namedType => namedType);

expect(printSchema(newSchema)).toEqual(printSchema(schema));
expect(printSchema(schema)).toEqual(originalSDL);
expect(printSchema(newSchema)).toEqual(originalSDL);
});
});
1 change: 1 addition & 0 deletions packages/apollo-graphql/src/schema/transformSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export function transformSchema(

return new GraphQLInterfaceType({
...config,
interfaces: () => config.interfaces.map(replaceNamedType),
fields: () => replaceFields(config.fields)
});
} else if (isUnionType(type)) {
Expand Down