Skip to content

Commit

Permalink
Include astNode in schema recreation (#569)
Browse files Browse the repository at this point in the history
* Update schemaRecreation.ts

`mergeSchemas` does not set `astNode` properties, when recreating types.
But `CacheControlExtension.willResolveField` uses the `astNode` property in order to get the `cacheControl` directives.
  • Loading branch information
BassT authored and freiksenet committed Jan 9, 2018
1 parent 4f489d3 commit fd9f626
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added GraphQL Subscriptions support for schema stitching and `makeRemoteExecutableSchema` [PR #563](https://github.com/apollographql/graphql-tools/pull/563)
* Make `apollo-link` a direct dependency [PR #561](https://github.com/apollographql/graphql-tools/pull/561)
* Update tests to use `graphql-js@0.12` docstring format [PR #559](https://github.com/apollographql/graphql-tools/pull/559)
* Include `astNode` property in schema recreation

### v2.15.0

Expand Down
4 changes: 4 additions & 0 deletions src/stitching/schemaRecreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export function recreateCompositeType(
name: type.name,
description: type.description,
isTypeOf: type.isTypeOf,
astNode: type.astNode,
fields: () => fieldMapToFieldConfigMap(fields, registry),
interfaces: () => interfaces.map(iface => registry.resolveType(iface)),
});
Expand All @@ -43,6 +44,7 @@ export function recreateCompositeType(
return new GraphQLInterfaceType({
name: type.name,
description: type.description,
astNode: type.astNode,
fields: () => fieldMapToFieldConfigMap(fields, registry),
resolveType: (parent, context, info) =>
resolveFromParentTypename(parent, info.schema),
Expand All @@ -51,6 +53,7 @@ export function recreateCompositeType(
return new GraphQLUnionType({
name: type.name,
description: type.description,
astNode: type.astNode,
types: () =>
type.getTypes().map(unionMember => registry.resolveType(unionMember)),
resolveType: (parent, context, info) =>
Expand All @@ -60,6 +63,7 @@ export function recreateCompositeType(
return new GraphQLInputObjectType({
name: type.name,
description: type.description,
astNode: type.astNode,
fields: () => inputFieldMapToFieldConfigMap(type.getFields(), registry),
});
} else {
Expand Down

0 comments on commit fd9f626

Please sign in to comment.