graphql.GraphQL.parseAndValidate()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(245)

本文整理了Java中graphql.GraphQL.parseAndValidate()方法的一些代码示例,展示了GraphQL.parseAndValidate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GraphQL.parseAndValidate()方法的具体详情如下:
包路径:graphql.GraphQL
类名称:GraphQL
方法名:parseAndValidate

GraphQL.parseAndValidate介绍

暂无

代码示例

代码示例来源:origin: graphql-java/graphql-java

private CompletableFuture<ExecutionResult> parseValidateAndExecute(ExecutionInput executionInput, GraphQLSchema graphQLSchema, InstrumentationState instrumentationState) {
  AtomicReference<ExecutionInput> executionInputRef = new AtomicReference<>(executionInput);
  PreparsedDocumentEntry preparsedDoc = preparsedDocumentProvider.get(executionInput.getQuery(),
      transformedQuery -> {
        // if they change the original query in the pre-parser, then we want to see it downstream from then on
        executionInputRef.set(executionInput.transform(bldr -> bldr.query(transformedQuery)));
        return parseAndValidate(executionInputRef, graphQLSchema, instrumentationState);
      });
  if (preparsedDoc.hasErrors()) {
    return CompletableFuture.completedFuture(new ExecutionResultImpl(preparsedDoc.getErrors()));
  }
  return execute(executionInputRef.get(), preparsedDoc.getDocument(), graphQLSchema, instrumentationState);
}

代码示例来源:origin: com.graphql-java/graphql-java

private CompletableFuture<ExecutionResult> parseValidateAndExecute(ExecutionInput executionInput, GraphQLSchema graphQLSchema, InstrumentationState instrumentationState) {
  AtomicReference<ExecutionInput> executionInputRef = new AtomicReference<>(executionInput);
  PreparsedDocumentEntry preparsedDoc = preparsedDocumentProvider.get(executionInput.getQuery(),
      transformedQuery -> {
        // if they change the original query in the pre-parser, then we want to see it downstream from then on
        executionInputRef.set(executionInput.transform(bldr -> bldr.query(transformedQuery)));
        return parseAndValidate(executionInputRef, graphQLSchema, instrumentationState);
      });
  if (preparsedDoc.hasErrors()) {
    return CompletableFuture.completedFuture(new ExecutionResultImpl(preparsedDoc.getErrors()));
  }
  return execute(executionInputRef.get(), preparsedDoc.getDocument(), graphQLSchema, instrumentationState);
}

相关文章