Skip to content
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

allow mutation type wrapping #1723

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/stitch/tests/alternateStitchSchemas.test.ts
Expand Up @@ -969,11 +969,11 @@ describe('rename nested object fields with interfaces', () => {

describe('WrapType query transform', () => {
test('should work', async () => {
const transformedPropertySchema = wrapSchema(bookingSchema, [
const transformedBookingSchema = wrapSchema(bookingSchema, [
new WrapType('Query', 'Namespace_Query', 'namespace'),
]);
const result = await graphql(
transformedPropertySchema,
transformedBookingSchema,
`
query($bid: ID!) {
namespace {
Expand Down Expand Up @@ -1024,11 +1024,11 @@ describe('WrapType query transform', () => {

describe('WrapType mutation transform', () => {
test('should work', async () => {
const transformedPropertySchema = wrapSchema(bookingSchema, [
const transformedBookingSchema = wrapSchema(bookingSchema, [
new WrapType('Mutation', 'Namespace_Mutation', 'namespace'),
]);
const result = await graphql(
transformedPropertySchema,
transformedBookingSchema,
`
mutation($bi: BookingInput!) {
namespace {
Expand Down Expand Up @@ -1070,8 +1070,8 @@ describe('WrapType mutation transform', () => {
{
locations: [
{
column: 13,
line: 8,
column: 15,
line: 9,
},
],
message: 'Booking.error error',
Expand Down
2 changes: 2 additions & 0 deletions packages/wrap/src/generateProxyingResolvers.ts
Expand Up @@ -107,12 +107,14 @@ function createPossiblyNestedProxyingResolver(

export function defaultCreateProxyingResolver({
schema,
operation,
transforms,
transformedSchema,
}: ICreateProxyingResolverOptions): GraphQLFieldResolver<any, any> {
return (_parent, _args, context, info) =>
delegateToSchema({
schema,
operation,
context,
info,
transforms,
Expand Down
4 changes: 3 additions & 1 deletion website/docs/remote-schemas.md
Expand Up @@ -201,17 +201,19 @@ export interface ICreateProxyingResolverOptions {
};
```

You may not need all the options to accomplish what you need. For example, the default proxying resolver creator just uses a subset of the passed arguments:
You may not need all the options to accomplish what you need. For example, the default proxying resolver creator just uses a subset of the passed arguments, with the fieldName inferred:

```ts
export function defaultCreateProxyingResolver({
schemaOrSubschemaConfig,
operation,
transforms,
transformedSchema,
}: ICreateProxyingResolverOptions): GraphQLFieldResolver<any, any> {
return (_parent, _args, context, info) =>
delegateToSchema({
schema: schemaOrSubschemaConfig,
operation,
context,
info,
transforms,
Expand Down