How to use the @graphql-codegen/plugin-helpers.removeFederation function in @graphql-codegen/plugin-helpers

To help you get started, we’ve selected a few @graphql-codegen/plugin-helpers 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 dotansimha / graphql-code-generator / packages / plugins / other / fragment-matcher / src / index.ts View on Github external
export const plugin: PluginFunction = async (schema: GraphQLSchema, _documents, pluginConfig: FragmentMatcherConfig, info): Promise => {
  const config: Required = {
    module: 'es2015',
    federation: false,
    ...pluginConfig,
  };

  const cleanSchema = config.federation
    ? removeFederation(schema, {
        withDirectives: false,
      })
    : schema;

  const introspection = await execute({
    schema: cleanSchema,
    document: parse(`
      {
        __schema {
          types {
            kind
            name
            possibleTypes {
              name
            }
          }
github dotansimha / graphql-code-generator / packages / plugins / other / schema-ast / src / index.ts View on Github external
export const plugin: PluginFunction = async (schema: GraphQLSchema, _documents, { commentDescriptions = false, includeDirectives = false, federation }): Promise => {
  const outputSchema = federation
    ? removeFederation(schema, {
        withDirectives: includeDirectives,
      })
    : schema;

  if (includeDirectives) {
    return printSchemaWithDirectives(outputSchema);
  }

  return printSchema(outputSchema, { commentDescriptions: commentDescriptions });
};
github dotansimha / graphql-code-generator / packages / plugins / other / introspection / src / index.ts View on Github external
export const plugin: PluginFunction = async (schema: GraphQLSchema, _documents, pluginConfig: IntrospectionPluginConfig): Promise => {
  const cleanSchema = pluginConfig.federation
    ? removeFederation(schema, {
        withDirectives: true,
      })
    : schema;

  const introspection = introspectionFromSchema(cleanSchema, { descriptions: true });

  return pluginConfig.minify ? JSON.stringify(introspection) : JSON.stringify(introspection, null, 2);
};