-
-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v7 #1935
Conversation
The latest changes of this PR are available as alpha in npm (based on the declared
|
7fe5997
to
f515b7e
Compare
9269c2c
to
0dedab2
Compare
Another proposal I'd offer here is to make |
🦋 Changeset detectedLatest commit: 09822d8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
8955e0a
to
4b8b3b5
Compare
What do we envision the changeset for v7 to look like? major version bump for everything or just the changed packages? |
Just the changed packages :) and those who are heavily effected by those changes. |
@yaacovCR how do I try out this version? |
@yaacovCR can you please rebase to latest |
8f87f41
to
fda89db
Compare
includes breaking changes to onTypeConflict, fieldConfigMerger and inputFieldConfigMerger
to allow batching when using the default executor
BREAKING CHANGE: batching is now performed (when enabled) for all subschema config objects with identical executors, removing the need for the endpoint abstraction
Wahoo!! Congrats! |
I don't get it tho. Now you have dependencies that got a minor update (6.2.5) depending on modules that got a major update (7.0.0). My node modules are a mess... |
Breaking Changes:
Schema Generation and Decoration API (
@graphql-tools/schema
)Resolver validation options should now be set to
error
,warn
orignore
rather thantrue
orfalse
. In previous versions, some of the validators caused errors to be thrown, while some issued warnings. This changes brings consistency to validator behavior.The
allowResolversNotInSchema
has been renamed torequireResolversToMatchSchema
, to harmonize the naming convention of all the validators. The default setting ofrequireResolversToMatchSchema
iserror
, matching the previous behavior.Schema Delegation (
delegateToSchema
&@graphql-tools/delegate
)The
delegateToSchema
return 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
,getErrorsByPathSegment
functions. Only external errors with missing or invalid paths must still be preserved by annotating the remote object with special properties. The newgetUnpathedErrors
function is therefore necessary for retrieving only these errors. Note also the newannotateExternalObject
andmergeExternalObjects
functions, as well as the renaming ofhandleResult
toresolveExternalValue
.Transform types and the
applySchemaTransforms
are now relocated to thedelegate
package;applyRequestTransforms
/applyResultTransforms
functions have been deprecated, however, as this functionality has been replaced since v6 by theTransformer
abstraction.The
transformRequest
/transformResult
methods are now provided additionaldelegationContext
andtransformationContext
arguments -- these were introduced in v6, but previously optional.The
transformSchema
method may wish to create additional delegating resolvers and so it is now provided thesubschemaConfig
and final (non-executable)transformedSchema
parameters. As in v6, thetransformSchema
is 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-executabel) initial result. In v7, the individualtransformSchema
methods also get access to the result of the first run, if necessary, they can create additional wrapping schema proxying resolvers.applySchemaTransforms
parameters have been updated to match and support thetransformSchema
parameters above.Remote Schemas & Wrapping (
wrapSchema
,makeRemoteExecutableSchema
, and@graphql-tools/wrap
)wrapSchema
andgenerateProxyingResolvers
now only take a single options argument with named properties of typeSubschemaConfig
. The previously possible shorthand version with first argument consisting of aGraphQLSchema
and second argument representing the transforms should be reworked as aSubschemaConfig
object.Similarly, the
ICreateProxyingResolverOptions
interface that provides the options for thecreateProxyingResolver
property ofSubschemaConfig
options has been adjusted. Theschema
property previously could be set to aGraphQLSchema
or aSubschemaConfig
object. This property has been removed in favor of asubschemaConfig
property that will always be aSubschemaConfig
object. Thetransforms
property has been removed; transforms should be included within theSubschemaConfig
object.`The format of the wrapping schema has solidified. All non-root fields are expected to use identical resolvers, either
defaultMergedResolver
or a custom equivalent, with root fields doing the hard work of proxying. Support for custom merged resolvers throughtcreateMergedResolver
has been deprecated, as custom merging resolvers conflicts when using stitching's type merging, where resolvers are expected to be identical across subschemas.The
WrapFields
transform'swrappingResolver
option 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 asTransformRootFields
orTransformObjectFields
.The
ExtendSchema
transform has been removed, as it is conceptually simpler just to usestitchSchemas
with one subschema.The
ReplaceFieldsWithFragment
,AddFragmentsByField
,AddSelectionSetsByField
, andAddMergedTypeSelectionSets
transforms has been removed, as they are superseded by theAddSelectionSets
andVisitSelectionSets
transforms. TheAddSelectionSets
purposely 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 theparseSelectionSet
function from@graphql-tools/utils
.Schema Stitching (
stitchSchemas
&@graphql-tools/stitch
)stitchSchemas
'smergeTypes
option is now true by default! This causes theonTypeConflict
option to be ignored by default. To useonTypeConflict
to select a specific type instead of simply merging, simply setmergeTypes
to false.schemas
argument has been deprecated, usesubschemas
,typeDefs
, ortypes
, depending on what you are stitching.When using batch delegation in type merging, the
argsFromKeys
function is now set only via theargsFromKeys
property. Previously, ifargsFromKeys
was absent, it could be read fromargs
.Support for fragment hints has been removed in favor of selection set hints.
stitchSchemas
now processes allGraphQLSchema
andSubschemaConfig
subschema input into newSubschema
objects, handling schema config directives such aso@computed
as well as generating the final transformed schema, stored as thetransformedSchema
property, if transforms are used. Signatures of theonTypeConflict
,fieldConfigMerger
, andinputFieldConfigMerger
have been updated to include metadata related to the original and transformed subschemas. Note the property name change foronTypeConflict
fromschema
tosubschema
.Mocking (
addMocksToSchema
and@graphql-tools/mock
)args
,context
, andinfo
withparent
available asthis
rather than as the first argument.Other Utilities (
@graphql-tools/utils
)filterSchema
'sfieldFilter
will now filter all fields across Object, Interface, and Input types. For the previous Object-only behavior, switch to theobjectFieldFilter
option.fieldNodes
utility functions have been removed.typeContainsSelectionSet
function has been removed, andtypesContainSelectionSet
has been moved to thestitch
package.Operation
type has been removed in favor ofOperationTypeNode
from upstream graphql-js.applySchemaTransforms
/applyRequestTransforms
/applyResultTransforms
have been removed from theutils
package, as they are implemented elsewhere or no longer necessary.