How to use the relay-compiler.convertASTDocuments function in relay-compiler

To help you get started, weโ€™ve selected a few relay-compiler 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 facebook / relay / packages / relay-test-utils / parseGraphQLText.js View on Github external
function parseGraphQLText(
  schema: GraphQLSchema,
  text: string,
): {
  definitions: $ReadOnlyArray,
  schema: ?GraphQLSchema,
} {
  const ast = parse(text);
  // TODO T24511737 figure out if this is dangerous
  const extendedSchema = extendSchema(schema, ast, {assumeValid: true});
  const definitions = convertASTDocuments(
    extendedSchema,
    [ast],
    [],
    Parser.transform.bind(Parser),
  );
  return {
    definitions,
    schema: extendedSchema !== schema ? extendedSchema : null,
  };
}
github facebook / relay / packages / relay-test-utils / parseGraphQLText.js View on Github external
function parseGraphQLText(
  schema: GraphQLSchema,
  text: string,
): {
  definitions: Array,
  schema: ?GraphQLSchema,
} {
  const ast = parse(text);
  const extendedSchema = extendSchema(schema, ast);
  const definitions = convertASTDocuments(
    extendedSchema,
    [ast],
    [],
    Parser.transform.bind(Parser),
  );
  return {
    definitions,
    schema: extendedSchema !== schema ? extendedSchema : null,
  };
}
github facebook / relay / packages / relay-test-utils-internal / parseGraphQLText.js View on Github external
function parseGraphQLText(
  schema: GraphQLSchema,
  text: string,
): {
  definitions: $ReadOnlyArray,
  schema: GraphQLSchema,
} {
  const ast = parse(text);
  const extendedSchema = extendSchema(schema, ast, {assumeValid: true});
  const definitions = convertASTDocuments(
    Schema.DEPRECATED__create(schema, extendedSchema),
    [ast],
    Parser.transform.bind(Parser),
  );
  return {
    definitions,
    schema: extendedSchema,
  };
}