How to use @graphql-tools/schema - 2 common examples

To help you get started, we’ve selected a few @graphql-tools/schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netgroup-polito / CrownLabs / qlkube / src / decorateBaseSchema.js View on Github external
if (parent[e] === undefined)
            throw `Error: ${e} is not into the parent object!`;
          newParent[e] = parent[e];
        }
        return newParent;
      },
    },
    [typeWrapper]: {
      [targetQuery]: (parent, args, context, info) => {
        return targetType.resolve(parent, parent, context, info);
      },
    },
  };

  const extendedSchema = extendSchema(baseSchema, extension);
  const newSchema = addResolversToSchema(extendedSchema, resolvers);
  return newSchema;
}
github netgroup-polito / CrownLabs / qlkube / src / decorateSubscription.js View on Github external
return payload;
        },
      },
    },
    [subscriptionType]: {
      updateType: (payload, args, context, info) => {
        return payload.type;
      },
      payload: (payload, args, context, info) => {
        return payload.apiObj;
      },
    },
  };

  const extendedSchema = extendSchema(baseSchema, extension);
  const newSchema = addResolversToSchema(extendedSchema, resolvers);
  newSchema._subscriptionType = newSchema._typeMap.Subscription;
  return newSchema;
}

@graphql-tools/schema

A set of utils for faster development of GraphQL tools

MIT
Latest version published 8 days ago

Package Health Score

95 / 100
Full package analysis

Popular @graphql-tools/schema functions

Similar packages