コード例 #1
0
 expect('fixtures/parser').toMatchGolden(text => {
   try {
     return prettyStringify(RelayParser.parse(RelayTestSchema, text));
   } catch (e) {
     return 'ERROR:\n' + e;
   }
 });
コード例 #2
0
 function addLogs(error, response, status) {
   if (graphiQLPrinter) {
     transaction.addLog('GraphiQL', graphiQLPrinter(operation, variables));
   }
   transaction.addLog('Cache Config', cacheConfig);
   transaction.addLog('Variables', prettyStringify(variables));
   if (status) {
     transaction.addLog('Status', status);
   }
   if (error) {
     transaction.addLog('Error', error);
   }
   if (response) {
     transaction.addLog('Response', response);
   }
 }
コード例 #3
0
 .map(doc => prettyStringify(RelayCodeGenerator.generate(doc)))
コード例 #4
0
 expect('fixtures/relay-flow-parser').toMatchGolden(text => {
   return prettyStringify(RelayFlowParser.parse(text, RelayTestSchema));
 });
コード例 #5
0
ファイル: RelayCodeGenerator.js プロジェクト: rosskevin/relay
      return {
        kind: 'Literal',
        name: parent.name,
        value: node.value,
        type: parent.type ? parent.type.toString() : null,
      };
    },

    Argument(node, key, parent, ancestors): ?ConcreteArgument {
      invariant(
        ['Variable', 'Literal'].indexOf(node.value.kind) >= 0,
        'RelayCodeGenerator: Complex argument values (Lists or ' +
          'InputObjects with nested variables) are not supported, argument ' +
          '`%s` had value `%s`. Source: %s.',
        node.name,
        prettyStringify(node.value),
        getErrorMessage(ancestors[0]),
      );
      return node.value.value !== null ? node.value : null;
    },
  },
};

function isPlural(type: any): boolean {
  return getNullableType(type) instanceof GraphQLList;
}

function valuesOrUndefined<T>(array: ?Array<T>): ?Array<T> {
  return !array || array.length === 0 ? undefined : array;
}
コード例 #6
0
ファイル: RelayParser-test.js プロジェクト: lprhodes/relay
 expect('fixtures/parser').toMatchGolden(text =>
   prettyStringify(RelayParser.parse(RelayTestSchema, text)),
コード例 #7
0
 doc =>
   RelayPrinter.print(doc) +
   '# Metadata:\n' +
   prettyStringify(doc.metadata),