Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Jun 2, 2022
1 parent 856aad3 commit 4cea6a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
21 changes: 11 additions & 10 deletions .changeset/fifty-experts-unite.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ If you are using the legacy parameters like below, you should update them to the

```ts
// From
addResolversToSchema(schema, resolvers, resolverValidationOptions);
addResolversToSchema(schema, resolvers, resolverValidationOptions)

// To
addResolversToSchema({
schema,
resolvers,
resolverValidationOptions,
resolverValidationOptions
})
```

Expand All @@ -25,6 +25,7 @@ addResolversToSchema({
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: `
Expand All @@ -34,17 +35,17 @@ const schema = makeExecutableSchema({
`,
resolvers: {
Query: {
hello: () => 'Hello world!',
},
},
});
hello: () => 'Hello world!'
}
}
})

mergeSchemas({
schemas: [schema],
resolvers: {
Query: {
hello: () => 'New hello world',
},
hello: () => 'New hello world'
}
}
})
```
Expand All @@ -55,13 +56,13 @@ mergeSchemas({
makeExecutableSchema({
typeDefs: ``,
parseOptions: {
assumeValid: true,
assumeValid: true
}
})

// After
makeExecutableSchema({
typeDefs: ``,
assumeValid: true,
assumeValid: true
})
```
10 changes: 3 additions & 7 deletions packages/schema/tests/schemaGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1961,9 +1961,7 @@ describe('can specify lexical parser options', () => {
}
`,
resolvers: {},
parseOptions: {
noLocation: true,
},
noLocation: true,
});

expect(schema.astNode!.loc).toBeUndefined();
Expand All @@ -1986,9 +1984,7 @@ describe('can specify lexical parser options', () => {
makeExecutableSchema({
typeDefs,
resolvers,
parseOptions: {
experimentalFragmentVariables: true,
},
experimentalFragmentVariables: true,
});
}).not.toThrowError();
});
Expand Down Expand Up @@ -2264,7 +2260,7 @@ describe('interface resolver inheritance', () => {
},
};
const schema = makeExecutableSchema({
parseOptions: { allowLegacySDLImplementsInterfaces: true },
allowLegacySDLImplementsInterfaces: true,
typeDefs: testSchemaWithInterfaceResolvers,
resolvers,
inheritResolversFromInterfaces: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/stitch/src/stitchSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export function stitchSchemas<TContext extends Record<string, any> = Record<stri
resolvers = {},
inheritResolversFromInterfaces = false,
resolverValidationOptions = {},
parseOptions = {},
pruningOptions,
updateResolversInPlace,
schemaExtensions,
...rest
}: IStitchSchemasOptions<TContext>): GraphQLSchema {
if (typeof resolverValidationOptions !== 'object') {
throw new Error('Expected `resolverValidationOptions` to be an object');
Expand Down Expand Up @@ -92,7 +92,7 @@ export function stitchSchemas<TContext extends Record<string, any> = Record<stri
originalSubschemaMap,
types,
typeDefs: typeDefs || [],
parseOptions,
parseOptions: rest,
extensions,
directiveMap,
schemaDefs,
Expand Down

0 comments on commit 4cea6a5

Please sign in to comment.