Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Merge Schemas behavior and remove legacy signature in addResolver…
…sToSchema (#4463) * Fix Merge Schemas behavior and remove legacy signature in addResolversToSchema * Go * More improvements * Go * Satisfy Bob * Try to fix website * Try sth
- Loading branch information
Showing
20 changed files
with
956 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
'@graphql-tools/schema': major | ||
--- | ||
|
||
Thanks @mattkrick and @borisno2! | ||
|
||
## Breaking changes | ||
|
||
`addResolversToSchema`; | ||
|
||
If you are using the legacy parameters like below, you should update them to the new usage. Other than that, there is no functional change; | ||
|
||
```ts | ||
// From | ||
addResolversToSchema(schema, resolvers, resolverValidationOptions) | ||
|
||
// To | ||
addResolversToSchema({ | ||
schema, | ||
resolvers, | ||
resolverValidationOptions | ||
}) | ||
``` | ||
|
||
`mergeSchemas`; | ||
|
||
The provided `resolver` overrides the resolvers in the `schema` with the same name; | ||
|
||
The `hello` resolver in the `schema` would be overridden by the `hello` resolver in the `resolvers`. Before it was opposite which is not expected. | ||
|
||
```ts | ||
const schema = makeExecutableSchema({ | ||
typeDefs: ` | ||
type Query { | ||
hello: String | ||
} | ||
`, | ||
resolvers: { | ||
Query: { | ||
hello: () => 'Hello world!' | ||
} | ||
} | ||
}) | ||
|
||
mergeSchemas({ | ||
schemas: [schema], | ||
resolvers: { | ||
Query: { | ||
hello: () => 'New hello world' | ||
} | ||
} | ||
}) | ||
``` | ||
|
||
`makeExecutableSchema` no longer takes `parseOptions` and you can pass those options directly; | ||
|
||
```ts | ||
makeExecutableSchema({ | ||
typeDefs: ``, | ||
parseOptions: { | ||
assumeValid: true | ||
} | ||
}) | ||
|
||
// After | ||
makeExecutableSchema({ | ||
typeDefs: ``, | ||
assumeValid: true | ||
}) | ||
``` | ||
|
||
`makeExecutableSchema` no longer does pruning and it doesn't take `pruningOptions` anymore. | ||
You can use `pruneSchema` from `@graphql-tools/utils` if you need. | ||
|
||
`extractExtensionsFromSchema` moved from `@graphql-tools/merge` to `@graphql-tools/schema`. | ||
And `travelSchemaPossibleExtensions` has been dropped in favor of `mapSchema`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.