How to use the @graphql-codegen/java-common.buildPackageNameFromPath function in @graphql-codegen/java-common

To help you get started, we’ve selected a few @graphql-codegen/java-common 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 / java / resolvers / src / index.ts View on Github external
export const plugin: PluginFunction = async (schema: GraphQLSchema, documents: Types.DocumentFile[], config: JavaResolversPluginRawConfig, { outputFile }): Promise => {
  const relevantPath = dirname(normalize(outputFile));
  const defaultPackageName = buildPackageNameFromPath(relevantPath);
  const visitor = new JavaResolversVisitor(config, schema, defaultPackageName);
  const printedSchema = printSchema(schema);
  const astNode = parse(printedSchema);
  const visitorResult = visit(astNode, { leave: visitor as any });
  const mappersImports = visitor.getImports();
  const packageName = visitor.getPackageName();
  const blockContent = visitorResult.definitions.filter(d => typeof d === 'string').join('\n');
  const wrappedContent = visitor.wrapWithClass(blockContent);

  return [packageName, mappersImports, wrappedContent].join('\n');
};
github dotansimha / graphql-code-generator / packages / plugins / java / apollo-android / src / operation-visitor.ts View on Github external
constructor(_schema: GraphQLSchema, rawConfig: JavaApolloAndroidPluginConfig, private _availableFragments: LoadedFragment[]) {
    super(_schema, rawConfig, {
      package: rawConfig.package || buildPackageNameFromPath(process.cwd()),
      fragmentPackage: rawConfig.fragmentPackage || 'fragment',
      typePackage: rawConfig.typePackage || 'type',
    });
  }

@graphql-codegen/java-common

GraphQL Code Generator utils library for developing Java plugins

MIT
Latest version published 1 year ago

Package Health Score

61 / 100
Full package analysis

Similar packages