diff --git a/packages/utils/src/heal.ts b/packages/utils/src/heal.ts index 1757c0ec856..b1791476fae 100644 --- a/packages/utils/src/heal.ts +++ b/packages/utils/src/heal.ts @@ -121,6 +121,9 @@ export function healTypes( } if (!config.skipPruning) { + // TODO: + // consider removing the default level of pruning in v7, + // see comments below on the pruneTypes function. pruneTypes(originalTypeMap, directives); } @@ -220,6 +223,14 @@ export function healTypes( } } +// TODO: +// consider removing the default level of pruning in v7 +// +// Pruning was introduced into healSchema in v5, so legacy schema directives relying on pruning +// during healing are likely to be rare. pruning is now recommended via the dedicated pruneSchema +// function which does not force pruning on library users and gives granular control in terms of +// pruning types. pruneSchema does recreate the schema -- a parallel version that prunes in place +// could be considered. function pruneTypes(typeMap: Record, directives: ReadonlyArray) { const implementedInterfaces = {}; Object.values(typeMap).forEach(namedType => { diff --git a/packages/utils/src/rewire.ts b/packages/utils/src/rewire.ts index 873f0304c90..1994bb6461a 100644 --- a/packages/utils/src/rewire.ts +++ b/packages/utils/src/rewire.ts @@ -67,6 +67,9 @@ export function rewireTypes( const newDirectives = directives.map(directive => rewireDirective(directive)); + // TODO: + // consider removing the default level of pruning in v7, + // see comments below on the pruneTypes function. return options.skipPruning ? { typeMap: newTypeMap, @@ -199,6 +202,13 @@ export function rewireTypes( } } +// TODO: +// consider removing the default level of pruning in v7 +// +// Pruning during mapSchema limits the ability to create an unpruned schema, which may be of use +// to some library users. pruning is now recommended via the dedicated pruneSchema function +// which does not force pruning on library users and gives granular control in terms of pruning +// types. function pruneTypes( typeMap: TypeMap, directives: Array