ae36a0eThanks @mattkrick! - Handle enum values correctly if they are arguments of directives defined in the extensions
-
#7685
6f3776cThanks @ardatan! - Support "federation/subgraph style" schemas inastFromSchemaandprintSchemaWithDirectivesIf a
GraphQLSchemadoesn't have any defined operation types, we should print the schema definition as an extension rather than omitting it entirely. They are not a valid schema on their own, but they are valid subgraph schemas in a federation setup, and it is possible to build such schemas withassumeValidoptions.// A schema without defined root types buildSchema( /* GraphQL */ ` extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key"]) type User @key(fields: "id") { id: ID! username: String } `, { assumeValid: true, assumeValidSDL: true } )
POTENTIAL BREAKING CHANGE: This can be a breaking change because now the schema above will be printed as the input, previously
extend schemawas converted toschema {}.
-
#7588
2118a80Thanks @EmrysMyrddin! - Add optional schema coordinate in error extensions. This extension allows to precisely identify the source of the error by automated tools like tracing or monitoring.This new feature is opt-in, you have to enable it using
schemaCoordinateInErrorsexecutor option.Caution: This feature, when enabled, will expose information about your schema. If you need to keep your schema private and secret, you should strip this attribute at serialization time before sending errors to the client.
import { parse } from 'graphql' import { normalizedExecutor } from '@graphql-tools/executor' import { getSchemaCoordinate } from '@graphql-tools/utils' import schema from './schema' const result = await normalizedExecutor({ schema, document: parse(`...`), schemaCoordinateInErrors: true // enable adding schema coordinate to graphql errors }) if (result.errors) { for (const error of result.errors) { console.log('Error in resolver ', error.coordinate, ':', error.message) // or with `getSchemaCoordinate` util, to workaround types if needed console.log('Error in resolver', getSchemaCoordinate(error), ':', error.message) } }
- #7683
2fe123aThanks @ardatan! - Revert #7683 which can cause unexpected breaking changes so as before the schema extension node will always be converted to a schema definition node
-
#7679
dddc5f6Thanks @ardatan! - Support "federation/subgraph style" schemas inastFromSchemaandprintSchemaWithDirectivesIf a
GraphQLSchemadoesn't have any defined operation types, we should print the schema definition as an extension rather than omitting it entirely. They are not a valid schema on their own, but they are valid subgraph schemas in a federation setup, and it is possible to build such schemas withassumeValidoptions.// A schema without defined root types buildSchema( /* GraphQL */ ` extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key"]) type User @key(fields: "id") { id: ID! username: String } `, { assumeValid: true, assumeValidSDL: true } )
-
#5269
fded91eThanks @uroslates! - Add default values to the argumentsWhen the schema is like following;
type Query { getAllPages(currentPage: Int = 0, pageSize: Int = 10, pageType: getAllPages_pageType = ContentPage, sort: String = "asc"): PagesList } enum getAllPages_pageType { ContentPage CategoryPage CatalogPage } type PagesList { ... }
The generated operation will be like following;
query getAllPages_query($currentPage: Int = 0, $pageSize: Int = 10, $pageType: getAllPages_pageType = ContentPage, $sort: String = "asc") { getAllPages(currentPage: $currentPage, pageSize: $pageSize, pageType: $pageType, sort: $sort) { ... } }
-
#7012
fd105f4Thanks @ardatan! - Fix the bug inmergeDeep;The following inputs and outputs are corrected;
mergeDeep([{a:2}, undefined])- Any nullish values should be ignored so it should return{a:2}mergeDeep([])- no sources should returnundefinedmergeDeep([undefined])- no sources should returnundefined
- #7281
53db005Thanks @EmrysMyrddin! - Add optionalsubgraphNamepreoperty to theExecutionRequestinterface for usage in Gateways like Hive Gateway.
-
#6977
90a717eThanks @ardatan! - In executor, do not use leakingregisterAbortSignalListener, and handle listeners inside the execution context -
#7025
26518deThanks @ardatan! - Better handling for field name handling inbuildOperationForField
- #6971
4a2eb14Thanks @ardatan! - dependencies updates:- Added dependency
@whatwg-node/promise-helpers@^1.0.0↗︎ (todependencies)
- Added dependency
-
#6822
53bb601Thanks @enisdenjo! - dependencies updates:- Updated dependency
dset@^3.1.4↗︎ (from^3.1.2, independencies)
- Updated dependency
-
#6822
53bb601Thanks @enisdenjo! - Bump dset dependency handling the CVE-2024-21529
- #6809
4912f19Thanks @AaronMoat! - Remove use ofVoidFunctiontype, which requires DOM types
-
#6789
2c70d27Thanks @n1ru4l! - - New helper functiongetAbortPromiseto get a promise rejected whenAbortSignalis aborted- New helper function
registerAbortSignalListenerto register a listener to abort a promise whenAbortSignalis aborted
Instead of using
.addEventListener('abort', () => {/* ... */}), we register a single listener to avoid warnings on Node.js likeMaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 abort listeners added. Use emitter.setMaxListeners() to increase limit. - New helper function
- #6769
6a8123bThanks @ardatan! - Improvements forfakePromiseso it can be used without params to create avoidPromise
020b9e4Thanks @ardatan! - `AbortSignal` in `GraphQLResolveInfo`, and `AbortSignal` in `ExecutionRequest`
-
#6737
1b24656Thanks @ardatan! - Handle array of primitives correctlyThe bug was following;
mergeDeep([{ options: ['$a', '$b'] }, { options: ['$c'] }, { options: ['$d', '$e'] }]) // results in { options: [{}, {}] }
- #6677
dc5043bThanks @enisdenjo! -onErrorandonEndcallbacks frommapAsyncIteratorare invoked only once regardless of how many timesthrow/returnwas called on the iterator
6291e14Thanks @ardatan! - Add all args from extensions to the AST even if they don't exist in the directive def
b8bf584Thanks @ardatan! - Introduce `getDirectiveExtensions` and refactor directive handling in the extensions
-
#6385
d0f7d75Thanks @tobiasdiez! - remove generic package export -
Updated dependencies [
d0f7d75]:- cross-inspect@1.0.1
- #6323
cacf20fThanks @ardatan! - Implement Symbol.dispose or Symbol.asyncDispose to make `Executor`s `Disposable`
-
#6238
0f7059bThanks @ardatan! - If the given objects are arrays with the same length, merge the elements.const a = [{ a: 1 }, { b: 2 }] const b = [{ c: 3 }, { d: 4 }] const result = mergeDeep(a, b) // [{ a: 1, c: 3 }, { b: 2, d: 4 }]
-
#6194
7368829Thanks @ardatan! - Handle interface objects in a different way -
#6188
e10c13aThanks @ardatan! - AddrespectArrayLengthflag tomergeDeepso instead of concatenating the arrays, elements of them will be merged if they have the same length
- #6105
5567347Thanks @ardatan! - Handle fields in unmerged types as both isolated and non-isolated fields
-
#6055
4093f70Thanks @enisdenjo! - Disallow new lines in paths when checking withisValidPathA string may sometimes look like a path but is not (like an SDL of a simple GraphQL schema). To make sure we don't yield false-positives in such cases, we disallow new lines in paths (even though most Unix systems support new lines in file names).
- #5931
baf3c28Thanks @henryqdineen! - fix filterSchema argument filter for schema with non-default root types
- #5924
f3ea7a5Thanks @EmrysMyrddin! - AddonEndonmapAsyncIterator.
-
accd58fdThanks @ardatan! - Extractinspectinto the newcross-inspectpackage -
Updated dependencies [
accd58fd]:- cross-inspect@1.0.0
- #5444
c1afb545Thanks @kennyjwilli! - Exports theDirectableGraphQLObjecttype.
- #5398
be3411c7Thanks @EmrysMyrddin! - incremental merge also merges extensions
-
#5396
bb8f169eThanks @ardatan! - dependencies updates:- Added dependency
dset@^3.1.2↗︎ (todependencies)
- Added dependency
-
#5396
bb8f169eThanks @ardatan! - Move the merging logic of incremental results to the utils package
-
#5274
944a68e8Thanks @ardatan! - Drop Node 14 support. Require Node.js>= 16 -
#5274
944a68e8Thanks @ardatan! -AggregateErroris no longer exported from@graphql-tools/utils. You can use the nativeAggregateErrorinstead.
- #5016
62d074beThanks @mayrn-techdivision! - Fixes introspection query issues when visiting field '__type'
- #4961
e3ec35edThanks @gilgardosh! - Bug fix: better handle array field types used for alias field names
- #4887
904fe770Thanks @ardatan! - Fix leak on Node 14 and add cancellation to async iterables correctly
- #4842
7411a5e7Thanks @charlypoly! - Fix validation swallowing fragments on naming conflicts
- #4827
c0639dd0Thanks @ardatan! - TypeError and all other GraphQLError s from argument value parsing should return 400
-
#4801
8f6d3efcThanks @ardatan! - BREAKING:checkValidationErrorshas been dropped andvalidateGraphQlDocumentsnow acceptsDocumentNode[]instead and it throws the originalGraphQLErrors with the correct stack trace -
#4796
80836fa7Thanks @saihaj! - updatecollectFieldsto support collecting deffered values
-
#4778
df5848b8Thanks @saihaj! - add isIterableObject, isObjectLike, isPromise, promiseReduce, hasOwnProperty -
#4778
df5848b8Thanks @saihaj! - addPathutil fromgraphql/jsutils
- #4661
403ed450Thanks @nicolaslt! - Add getArgumentsWithDirectives
- #4694
71cb4faeThanks @dimatill! - Fix pruneSchema to not remove type that is used only as a directive argument type
- #4624
e3167edcThanks @n1ru4l! - Fix CommonJS TypeScript resolution withmoduleResolutionnode16ornodenext
-
2a3b45e3: Allow
&in filenames.Related to dotansimha/graphql-code-generator#6174
- d76a299c: Support TypeScript module resolution.
- a0abbbcd: fix(visitResult): handle introspection fields correctly with an introspection query result
-
4914970b:
mergeSchemaswas skippingdefaultFieldResolveranddefaultMergedResolverby default while extracting resolvers for each given schema to reduce the overhead. But this doesn't work properly if you mix wrapped schemas and local schemas. So newincludeDefaultMergedResolverflag is introduced ingetResolversFromSchemato put default "proxy" resolvers in the extracted resolver map formergeSchemas.This fixes an issue with alias issue, so nested aliased fields weren't resolved properly because of the missing
defaultMergedResolverin the final merged schema which should come from the wrapped schema.
- 041c5ba1: Use caret range for the tslib dependency
- da7ad43b: Fix GraphQL v17 incompatibility issues and introduce
createGraphQLErrorhelper function for backwards compatibility.
- c0762ee3: Incoming GraphQL v17 compatibility #4468
- 0fc510cb: Interface implementations should be included when a return type is an interface.
- 31a33e2b: pruneSchema will no longer removed used input object type.
- cb238877: pruneSchema will now prune unused implementations of interfaces
-
0bbb1769: Refine generic typings using
extends Xwhen appropriateTypescript 4.7 has stricter requirements around generics which is explained well in the related PR: microsoft/TypeScript#48366
These changes resolve the errors that these packages will face when attempting to upgrade to TS 4.7 (still in beta at the time of writing this). Landing these changes now will allow other TS libraries which depend on these packages to experiment with TS 4.7 in the meantime.
- 904c0847: Support deprecated directive on enum values
- be2c02d7: fix(utils): use 3 as inspect recursive depth
- d36d530b: fix(utils): pass the value as-is if it cannot be parsed by the actual type
- 3da3d66c: fix - align versions
- 18341363: feat(visitResult): ignore if field not present in visited object
-
43a60f93: Improve getArgumentValues check for null values
-
20e1058b: fix pruneSchema
Schema pruning must be done in rounds, as pruning types will automatically prune any fields that rely on them (within mapSchema), but then the empty types may also require pruning.
- 69b316c2: feat(utils): more withCancel utils
- 7b5d72c5: enhance(utils): better typing for withCancel
- 51315610: enhance: avoid using globalThis
- 960e178a: fix: isAsyncIterable should check if it is an object with iterator factory function
- 947a3fe0: enhance(utils): show error with details in inspect fn
- 233e0379: fix(utils): respect new specifiedByURL of GraphQL v16
- 4bfb3428: enhance: use ^ for tslib dependency
- ad04dc79: enhance: make operationType optional
- 149afddb: fix: getting ready for GraphQL v16
- 58262be7: feat(utils): export createDefaultRules
- 1043219f: fix implicit dependencies
- 014937db: batch-execute enhancements:
- fixes bugs with batched fragment definitions
- unpathed errors are now returned for all batch results
- the "graphqlTools" prefix is simplified down to just "_"
- new tests and documentation
- da157d62: fix(utils): Avoid processing read-only properties on visitData method
- d4918a78: fix(commentDescriptions): handle descriptions and comments correctly during merge
- 50609df8: fix(utils): print specifiedBy directive correctly
- be6fdb88: fix(utils): bring back breaking change for fixSchemaAst
- c5b0719c: enhance(utils): copy inspect util from graphql-js
- c5b0719c: feat: GraphQL v16 support
- c5b0719c: enhance(utils): move memoize functions to utils
- c5b0719c: enhance(utils): copy collectFields from graphql-js@16 for backwards compat
- c5b0719c: enhance(utils): memoize root types utility functions
- c8c13ed1: enhance: remove TypeMap and small improvements
- 2c807ddb: enhance(buildOperationNodeForField): mutation response return a field of type Query
-
b9684631: feat(validate-documents): more clear error messages with stack
-
67691b78: -
schemaExtensionsoption has been added tomergeSchemas,makeExecutableSchemaandstitchSchemasconfigurationsBreaking Changes;
- Move
mergeSchemasandMergeSchemasConfigfrom@graphql-tools/mergeto@graphql-tools/schemapackage to prevent circular dependency between them. mergeSchemasAsynchas been removed.- Move
NamedDefinitionNode,resetComments,collectComment,pushCommentandprintCommentfrom@graphql-tools/mergeto@graphql-tools/utils.
- Move
- 9ede806a: enhance(utils): use inspect from graphql-js instead of node:util #3324
- 04830049: fix(utils): support old TypeScript versions
- b823dbaf: fix(utils): fix AggregateErrorConstructor type issue
-
af9a78de: BREAKING CHANGE
-
Now each loader handles glob patterns internally and returns an array of
Sourceobject instead of singleSource -
GraphQL Tag Pluck now respects code locations and returns graphql-js
Sourceobjects for each found code block -
Thanks to the one above,
CodeFileLoadernow returns differentSourceobjects for each found SDL code block.
-
-
7d3e3006: BREAKING CHANGE
- Remove
fieldToFieldConfig,argsToFieldConfigArgumentandargumentToArgumentConfig -
- You can use
.toConfigmethod instead for each.
- You can use
- Remove
-
7d3e3006: BREAKING CHANGE
- Legacy Schema Directives and Directive Resolvers have been removed
-
- You can check the new method for both;
-
dae6dc7b: refactor: ExecutionParams type replaced by Request type
rootValue property is now a part of the Request type.
When delegating with delegateToSchema, rootValue can be set multiple ways:
- when using a custom executor, the custom executor can utilize a rootValue in whichever custom way it specifies.
- when using the default executor (execute/subscribe from graphql-js): -- rootValue can be passed to delegateToSchema via a named option -- rootValue can be included within a subschemaConfig -- otherwise, rootValue is inferred from the originating schema
When using wrapSchema/stitchSchemas, a subschemaConfig can specify the createProxyingResolver function which can pass whatever rootValue it wants to delegateToSchema as above.
-
6877b913: BREAKING CHANGES;
mergeDeepnow takes an array of sources instead of set of parameters as input and it takes an additional flag to enable prototype merging Instead ofmergeDeep(...sources)=>mergeDeep(sources) -
c42e811d: BREAKING CHANGES;
- Rename
RequesttoExecutionRequest - Add required
operationType: OperationTypeNodefield inExecutionRequest - Add
contextincreateRequestandcreateRequestInfoinstead ofdelegateToSchema
It doesn't rely on info.operation.operationType to allow the user to call an operation from different root type. And it doesn't call getOperationAST again and again to get operation type from the document/operation because we have it in Request and ExecutionParams https://github.com/ardatan/graphql-tools/pull/3166/files#diff-d4824895ea613dcc1f710c3ac82e952fe0ca12391b671f70d9f2d90d5656fdceR38
Improvements;
- Memoize
defaultExecutorfor a singleGraphQLSchemaso allowgetBatchingExecutorto memoizebatchingExecutorcorrectly. - And there is no different
defaultExecutoris created forsubscriptionand other operation types. Only one executor is used.
Batch executor is memoized by
executorreference butcreateDefaultExecutordidn't memoize the default executor so this memoization wasn't working correctly onbatch-executeside. https://github.com/ardatan/graphql-tools/blob/remove-info-executor/packages/batch-execute/src/getBatchingExecutor.ts#L9 - Rename
-
7d3e3006: BREAKING CHANGE
- Now it uses the native
AggregateErrorimplementation. The major difference is the individual errors are kept undererrorsproperty instead of the object itself withSymbol.iterator.
// From; for (const error of aggregateError) // To; for (const error of aggregateError.errors)
- Now it uses the native
-
8c8d4fc0: BREAKING CHANGE: remove cloneSchema
-
7d3e3006: BREAKING CHANGE
- No longer exports
debugLogbut usesconsole.logdirectly only ifDEBUGis available underprocess.env
- No longer exports
-
7d3e3006: BREAKING CHANGE
- No longer applies
camelCasenaming convention inbuildOperationNodeForField
- No longer applies
-
74581cf3: fix(getDirectives): preserve order around repeatable directives
BREAKING CHANGE: getDirectives now always return an array of individual DirectiveAnnotation objects consisting of
nameandargsproperties.New useful function
getDirectivereturns an array of objects representing any args for each use of a single directive (returning the empty object{}when a directive is used without arguments).Note: The
getDirectivefunction returns an array even when the specified directive is non-repeatable. This is because one use of this function is to throw an error if more than one directive annotation is used for a non repeatable directive!When specifying directives in extensions, one can use either the old or new format.
-
c0ca3190: BREAKING CHANGE
- Remove Subscriber and use only Executor
-
- Now
Executorcan receiveAsyncIterableand subscriptions will also be handled byExecutor. This is a future-proof change for defer, stream and live queries
- Now
-
7d3e3006: BREAKING CHANGE
- No longer exports
SchemaVisitor,visitSchemaandVisitSchemaKind -
- Use
mapSchemainstead
- Use
- No longer exports
- 9c26b847: enhance(loaders): remove optional methods from the Loader interface
- 7d3e3006: feat(utils): Respect operationName and rootValue in ExecutionParams
- 982c8f53: enhance(utils): refactor, cleanup and remove extra work
- e632c5d1: Make executors not generic over context types
- 99f092fd: fix(getResolversFromSchema) Fix resolvers for type names starting with a single underscore.
- be23817f: enhance(utils): do not extract default resolvers
- 20d2c7bc: feat(utils): add withCancel
- dbdb78e0: fix(visitResult): don't throw on encountering __typename in request (#2860)
- 03c579b1: enhance(utils): astFromDirective doesn't need schema anymore
- d2a17c70: enhance(printSchemaWithDirectives): show directives before other definitions #2752
- a4f1ee58: __ is reserved for introspection
- 194ac370: fix(utils): add createSchemaDefinition again to fix breaking change
- 58fd4b28: feat(types): add TContext to stitchSchemas and executor
- 43da6b59: enhance(merge): reduce number of iterations
- 5b637e2f: Add generic pruning filter option
- de16fff4: Fix pruneSchema with unimplemented interfaces
- 33d1b9e7: Fix pruneSchema with unused interfaces
- 219ed392: enhance(utils): Extract getDocumentNodeFromSchema from printSchemaWithDirectives
- 219ed392: fix(utils): fix missing default value of input object type field
- 219ed392: fix(utils): print specifiedBy directive definitions correctly
- 8f331aaa: enhance(utils): Extract getDocumentNodeFromSchema from printSchemaWithDirectives
- 8f331aaa: fix(utils): fix missing default value of input object type field
- 6387572c: feat(utils): export astFrom* helper functions
- e53f97b3: fix(utils): provide
{ done: true }from iterator when complete is called on observer in observableToAsyncIterable
-
4fc05eb7: Fixes the handling of repeatable directives in the
getDirectivesmethod. Previously repeatable directives were nested and duplicated. They will now return as a flat array map:@mydir(arg: "first") @mydir(arg: "second")
translates into:
{ mydir: [{ arg: 'first' }, { arg: 'second' }] }
-
6e50d9fc: enhance(stitching-directives): use keyField
When using simple keys, i.e. when using the keyField argument to
@merge, the keyField can be added implicitly to the types' key. In most cases, therefore,@keyshould not be required at all.
- 3d1340a3: fix(printSchemaWithDirectives): typo
- 63ab0034: fix(printSchemaWithDirectives): should print directives where used, even if directives themselves are not defined within the schema.
- 270046a1: fix(TransformInputObjectFields): transform variables #2353
- c3996f60: enhance(utils): support code-first schemas by allowing directives to be read from extensions
- c3996f60: fix(stitchingDirectives): complete support for code first schemas
- c3996f60: fix(printSchemaWithDirectives): should work for code-first schemas as well
- c3996f60: enhance(utils) filter root field arguments with filterSchema
- cd5da458: fix(utils): fix crashes when return null while visitSchema
- 298cd39e: fix(url-loader): do not fail multipart request when null variable given
- 4240a959: fix(utils): fix Observable signature for observableToAsyncIterator
- 6165c827: Trow on SDL syntax errors
- 21da6904: fix release
- b48a91b1: add ability to specify merge config within subschemas using directives
- 4f5a4efe: enhance(schema): add some options to improve schema creation performance
- e3176633: fix(utils): revert to old observableToAsyncIterable return type
- 8133a907: fix(utils): Remove $ from invalidPathRegex
- 2b6c813e: fix(utils): fix typing mismatch between linkToSubscriber and observableToAsyncIterable
-
be1a1575: ## Breaking Changes:
-
Resolver validation options should now be set to
error,warnorignorerather thantrueorfalse. In previous versions, some of the validators caused errors to be thrown, while some issued warnings. This changes brings consistency to validator behavior. -
The
allowResolversNotInSchemahas been renamed torequireResolversToMatchSchema, to harmonize the naming convention of all the validators. The default setting ofrequireResolversToMatchSchemaiserror, matching the previous behavior.
-
The
delegateToSchemareturn value has matured and been formalized as anExternalObject, in which all errors are integrated into the GraphQL response, preserving their initial path. Those advanced users accessing the result directly will note the change in error handling. This also allows for the deprecation of unnecessary helper functions includingslicedError,getErrors,getErrorsByPathSegmentfunctions. Only external errors with missing or invalid paths must still be preserved by annotating the remote object with special properties. The newgetUnpathedErrorsfunction is therefore necessary for retrieving only these errors. Note also the newannotateExternalObjectandmergeExternalObjectsfunctions, as well as the renaming ofhandleResulttoresolveExternalValue. -
Transform types and the
applySchemaTransformsare now relocated to thedelegatepackage;applyRequestTransforms/applyResultTransformsfunctions have been deprecated, however, as this functionality has been replaced since v6 by theTransformerabstraction. -
The
transformRequest/transformResultmethods are now provided additionaldelegationContextandtransformationContextarguments -- these were introduced in v6, but previously optional. -
The
transformSchemamethod may wish to create additional delegating resolvers and so it is now provided thesubschemaConfigand final (non-executable)transformedSchemaparameters. As in v6, thetransformSchemais kicked off once to produce the non-executable version, and then, if a wrapping schema is being generated, proxying resolvers are created with access to the (non-executable) initial result. In v7, the individualtransformSchemamethods also get access to the result of the first run, if necessary, they can create additional wrapping schema proxying resolvers. -
applySchemaTransformsparameters have been updated to match and support thetransformSchemaparameters above.
-
wrapSchemaandgenerateProxyingResolversnow only take a single options argument with named properties of typeSubschemaConfig. The previously possible shorthand version with first argument consisting of aGraphQLSchemaand second argument representing the transforms should be reworked as aSubschemaConfigobject. -
Similarly, the
ICreateProxyingResolverOptionsinterface that provides the options for thecreateProxyingResolverproperty ofSubschemaConfigoptions has been adjusted. Theschemaproperty previously could be set to aGraphQLSchemaor aSubschemaConfigobject. This property has been removed in favor of asubschemaConfigproperty that will always be aSubschemaConfigobject. Thetransformsproperty has been removed; transforms should be included within theSubschemaConfigobject.` -
The format of the wrapping schema has solidified. All non-root fields are expected to use identical resolvers, either
defaultMergedResolveror a custom equivalent, with root fields doing the hard work of proxying. Support for custom merged resolvers throughtcreateMergedResolverhas been deprecated, as custom merging resolvers conflicts when using stitching's type merging, where resolvers are expected to be identical across subschemas. -
The
WrapFieldstransform'swrappingResolveroption has been removed, as this complicates multiple wrapping layers, as well as planned functionality to wrap subscription root fields in potentially multiple layers, as the wrapping resolvers may be different in different layers. Modifying resolvers can still be performed by use of an additional transform such asTransformRootFieldsorTransformObjectFields. -
The
ExtendSchematransform has been removed, as it is conceptually simpler just to usestitchSchemaswith one subschema. -
The
ReplaceFieldsWithFragment,AddFragmentsByField,AddSelectionSetsByField, andAddMergedTypeSelectionSetstransforms has been removed, as they are superseded by theAddSelectionSetsandVisitSelectionSetstransforms. TheAddSelectionSetspurposely takes parsed SDL rather than strings, to nudge end users to parse these strings at build time (when possible), rather than at runtime. Parsing of selection set strings can be performed using theparseSelectionSetfunction from@graphql-tools/utils.
-
stitchSchemas'smergeTypesoption is now true by default! This causes theonTypeConflictoption to be ignored by default. To useonTypeConflictto select a specific type instead of simply merging, simply setmergeTypesto false. -
schemasargument has been deprecated, usesubschemas,typeDefs, ortypes, depending on what you are stitching. -
When using batch delegation in type merging, the
argsFromKeysfunction is now set only via theargsFromKeysproperty. Previously, ifargsFromKeyswas absent, it could be read fromargs. -
Support for fragment hints has been removed in favor of selection set hints.
-
stitchSchemasnow processes allGraphQLSchemaandSubschemaConfigsubschema input into newSubschemaobjects, handling schema config directives such aso@computedas well as generating the final transformed schema, stored as thetransformedSchemaproperty, if transforms are used. Signatures of theonTypeConflict,fieldConfigMerger, andinputFieldConfigMergerhave been updated to include metadata related to the original and transformed subschemas. Note the property name change foronTypeConflictfromschematosubschema.
- Mocks returning objects with fields set as functions are now operating according to upstream
graphql-js convention, i.e. these functions take three arguments,
args,context, andinfowithparentavailable asthisrather than as the first argument.
filterSchema'sfieldFilterwill now filter all fields across Object, Interface, and Input types. For the previous Object-only behavior, switch to theobjectFieldFilteroption.- Unused
fieldNodesutility functions have been removed. - Unused
typeContainsSelectionSetfunction has been removed, andtypesContainSelectionSethas been moved to thestitchpackage. - Unnecessary
Operationtype has been removed in favor ofOperationTypeNodefrom upstream graphql-js. - As above,
applySchemaTransforms/applyRequestTransforms/applyResultTransformshave been removed from theutilspackage, as they are implemented elsewhere or no longer necessary.
- proxy all the errors: #1047, #1641
- better error handling for merges #2016, #2062
- fix typings #1614
- disable implicit schema pruning #1817
- mocks not working for functions #1807
-
- 32c3c4f8: Fix duplication of scalar directives in merge
- 533d6d53: Bump all packages to allow adjustments