public interface DgsReactiveQueryExecutor
Mono for its results.
See DgsQueryExecutor for the blocking version of this interface.
Use this interface to easily execute GraphQL queries, without using the HTTP endpoint.
This is meant to be used in tests, and is also used internally in the framework.
The executeAnd* methods use the JsonPath library library to easily get specific fields out of a nested Json structure.
The executeAndGetDocumentContext(String) method sets up a DocumentContext, which can then be reused to get multiple fields.
| Modifier and Type | Method and Description |
|---|---|
default reactor.core.publisher.Mono<graphql.ExecutionResult> |
execute(java.lang.String query) |
default reactor.core.publisher.Mono<graphql.ExecutionResult> |
execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables) |
default reactor.core.publisher.Mono<graphql.ExecutionResult> |
execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.util.Map<java.lang.String,java.lang.Object> extensions,
org.springframework.http.HttpHeaders headers) |
reactor.core.publisher.Mono<graphql.ExecutionResult> |
execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.util.Map<java.lang.String,java.lang.Object> extensions,
org.springframework.http.HttpHeaders headers,
java.lang.String operationName,
org.springframework.web.reactive.function.server.ServerRequest serverRequest)
Executes a GraphQL query.
|
default reactor.core.publisher.Mono<graphql.ExecutionResult> |
execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.lang.String operationName) |
default <T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath)
Executes a GraphQL query, parses the returned data, and uses a Json Path to extract specific elements out of the data.
|
default <T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables)
Executes a GraphQL query, parses the returned data, and uses a Json Path to extract specific elements out of the data.
|
<T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables,
org.springframework.web.reactive.function.server.ServerRequest serverRequest)
Executes a GraphQL query, parses the returned data, and uses a Json Path to extract specific elements out of the data.
|
default <T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath,
org.springframework.web.reactive.function.server.ServerRequest serverRequest)
Executes a GraphQL query, parses the returned data, and uses a Json Path to extract specific elements out of the data.
|
default <T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
java.lang.Class<T> clazz)
Executes a GraphQL query, parses the returned data, extracts a value using JsonPath, and converts that value into the given type.
|
<T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.lang.Class<T> clazz)
Executes a GraphQL query, parses the returned data, extracts a value using JsonPath, and converts that value into the given type.
|
<T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables,
com.jayway.jsonpath.TypeRef<T> typeRef)
Executes a GraphQL query, parses the returned data, extracts a value using JsonPath, and converts that value into the given type.
|
default <T> reactor.core.publisher.Mono<T> |
executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
com.jayway.jsonpath.TypeRef<T> typeRef)
Executes a GraphQL query, parses the returned data, extracts a value using JsonPath, and converts that value into the given type.
|
default reactor.core.publisher.Mono<com.jayway.jsonpath.DocumentContext> |
executeAndGetDocumentContext(java.lang.String query)
Executes a GraphQL query, parses the returned data, and return a
DocumentContext. |
reactor.core.publisher.Mono<com.jayway.jsonpath.DocumentContext> |
executeAndGetDocumentContext(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables)
Executes a GraphQL query, parses the returned data, and return a
DocumentContext. |
default reactor.core.publisher.Mono<graphql.ExecutionResult> execute(java.lang.String query)
query - The query stringExecutionResult. This includes data and errors.default reactor.core.publisher.Mono<graphql.ExecutionResult> execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables)
query - The query stringvariables - A map of variablesExecutionResult. This includes data and errors.default reactor.core.publisher.Mono<graphql.ExecutionResult> execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.lang.String operationName)
query - The query stringvariables - A map of variablesoperationName - The operation nameExecutionResult. This includes data and errors.default reactor.core.publisher.Mono<graphql.ExecutionResult> execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.util.Map<java.lang.String,java.lang.Object> extensions,
org.springframework.http.HttpHeaders headers)
query - The query stringvariables - A map of variablesextensions - A map representing GraphQL extensions. This is made available in the
DgsRequestData object on
DgsContext.headers - Request headers represented as a Spring Framework HttpHeadersExecutionResult. This includes data and errors.reactor.core.publisher.Mono<graphql.ExecutionResult> execute(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.util.Map<java.lang.String,java.lang.Object> extensions,
org.springframework.http.HttpHeaders headers,
java.lang.String operationName,
org.springframework.web.reactive.function.server.ServerRequest serverRequest)
query - The query stringvariables - A map of variablesextensions - A map representing GraphQL extensions. This is made available in the DgsRequestData
object on DgsContext.headers - Request headers represented as a Spring Framework HttpHeadersoperationName - Operation nameserverRequest - A Spring ServerRequest giving access to request details.ExecutionResult. This includes data and errors.default <T> reactor.core.publisher.Mono<T> executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath)
executeAndExtractJsonPathAsObject(String, String, TypeRef) instead.
This only works for primitive types and map representations.
Use executeAndExtractJsonPathAsObject(String, String, Class) for complex types and lists.
T - The type of primitive or map representation that should be returned.query - Query stringjsonPath - JsonPath expression.<T> reactor.core.publisher.Mono<T> executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables,
org.springframework.web.reactive.function.server.ServerRequest serverRequest)
executeAndExtractJsonPathAsObject(String, String, TypeRef)instead.
This only works for primitive types and map representations.
Use executeAndExtractJsonPathAsObject(String, String, Class) for complex types and lists.*
T - The type of primitive or map representation that should be returned.query - Query stringjsonPath - JsonPath expression.variables - A Map of variablesserverRequest - A Spring ServerRequest giving access to request details. *default <T> reactor.core.publisher.Mono<T> executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables)
executeAndExtractJsonPathAsObject(String, String, TypeRef)instead.
This only works for primitive types and map representations.
Use executeAndExtractJsonPathAsObject(String, String, Class) for complex types and lists.*
T - The type of primitive or map representation that should be returned.query - Query stringjsonPath - JsonPath expression.variables - A Map of variablesdefault <T> reactor.core.publisher.Mono<T> executeAndExtractJsonPath(java.lang.String query,
java.lang.String jsonPath,
org.springframework.web.reactive.function.server.ServerRequest serverRequest)
executeAndExtractJsonPathAsObject(String, String, TypeRef)instead.
This only works for primitive types and map representations.
Use executeAndExtractJsonPathAsObject(String, String, Class) for complex types and lists.*
T - The type of primitive or map representation that should be returned.query - Query stringjsonPath - JsonPath expression.serverRequest - A Spring ServerRequest giving access to request details.default reactor.core.publisher.Mono<com.jayway.jsonpath.DocumentContext> executeAndGetDocumentContext(java.lang.String query)
DocumentContext.
A DocumentContext can be used to extract multiple values using JsonPath, without re-executing the query.query - GraphQL query stringDocumentContext is a JsonPath type used to extract values from.reactor.core.publisher.Mono<com.jayway.jsonpath.DocumentContext> executeAndGetDocumentContext(java.lang.String query,
java.util.Map<java.lang.String,java.lang.Object> variables)
DocumentContext.
A DocumentContext can be used to extract multiple values using JsonPath, without re-executing the query.query - GraphQL query stringvariables - A Map of variablesDocumentContext is a JsonPath type used to extract values from.default <T> reactor.core.publisher.Mono<T> executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
java.lang.Class<T> clazz)
T - The type that the extracted value should be converted to.query - GraphQL query stringjsonPath - JsonPath expression.clazz - The type to convert the extracted value to.<T> reactor.core.publisher.Mono<T> executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables,
java.lang.Class<T> clazz)
T - The type that the extracted value should be converted to.query - GraphQL query stringjsonPath - JsonPath expression.variables - A Map of variablesclazz - The type to convert the extracted value to.default <T> reactor.core.publisher.Mono<T> executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
com.jayway.jsonpath.TypeRef<T> typeRef)
TypeRef to specify the expected type, which is useful for Lists and Maps.
Be aware that this method can't guarantee type safety.T - The type that the extracted value should be converted to.query - Query stringjsonPath - JsonPath expression.typeRef - A JsonPath [TypeRef] representing the expected result type.<T> reactor.core.publisher.Mono<T> executeAndExtractJsonPathAsObject(java.lang.String query,
java.lang.String jsonPath,
java.util.Map<java.lang.String,java.lang.Object> variables,
com.jayway.jsonpath.TypeRef<T> typeRef)
TypeRef to specify the expected type, which is useful for Lists and Maps.
Be aware that this method can't guarantee type safety.T - The type that the extracted value should be converted to.query - Query stringjsonPath - JsonPath expression.variables - A Map of variablestypeRef - A JsonPath TypeRef representing the expected result type.