How to use the apollo-language-server/lib/errors/validation.validateQueryDocument function in apollo-language-server

To help you get started, we’ve selected a few apollo-language-server 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 apollographql / apollo-tooling / packages / apollo / src / generate.ts View on Github external
export default function generate(
  document: DocumentNode,
  schema: GraphQLSchema,
  outputPath: string,
  only: string | undefined,
  target: TargetType,
  tagName: string,
  nextToSources: boolean | string,
  options: GenerationOptions
): number {
  let writtenFiles = 0;
  validateQueryDocument(schema, document);

  const { rootPath = process.cwd() } = options;
  if (outputPath.split(".").length <= 1 && !fs.existsSync(outputPath)) {
    fs.mkdirSync(outputPath);
  }

  if (target === "swift") {
    options.addTypename = true;
    const context = compileToIR(schema, document, options);

    const outputIndividualFiles =
      fs.existsSync(outputPath) && fs.statSync(outputPath).isDirectory();

    const suppressSwiftMultilineStringLiterals = Boolean(
      options.suppressSwiftMultilineStringLiterals
    );