I have been trying to get the values of the custom headers I send from the client request. Upon checking the code, the header value is available till the execution function, i.e.,
@PostMapping(value = "/graphql", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map<String, Object> indexFromAnnotated(@RequestBody Map<String, String> request, HttpServletRequest raw) { ExecutionResult executionResult = graphQL.execute(ExecutionInput.newExecutionInput() .query(request.get("query")) .operationName(request.get("operationName")) .context(raw) .build()); return executionResult.toSpecification(); }
Now, my query let's say is mapped to the following function
`@GraphQLQuery(name = "firstNPersons")
public List getFirstNPersons(@GraphQLArgument(name = "count") int count) {
List result = new ArrayList<>();
Person p1 = new Person();
p1.setFirstName("John");
p1.setLastName("Doe");
result.add(p1);
Person p2 = new Person();
p2.setFirstName("Jane");
p2.setLastName("Doe");
result.add(p2);
return result.stream().limit(count).collect(Collectors.toList());
}`
How do I get the executionResult variable in my GraphQLQuery.
I have skimmed through the documentation and issues, but not able to find the answer.
On a side note, we are thinking of integrating one of our major services to graphQL, only some APIs. So, I stumbled across this project. Looks like the project is using the standard GraphQL specification, but still there's lesser community involvement. Should we go ahead with the library or rather implement graphQL from scratch. As I see it, the only benefit this library is giving is to generate the schema file automatically.
I have been trying to get the values of the custom headers I send from the client request. Upon checking the code, the header value is available till the execution function, i.e.,
@PostMapping(value = "/graphql", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Map<String, Object> indexFromAnnotated(@RequestBody Map<String, String> request, HttpServletRequest raw) { ExecutionResult executionResult = graphQL.execute(ExecutionInput.newExecutionInput() .query(request.get("query")) .operationName(request.get("operationName")) .context(raw) .build()); return executionResult.toSpecification(); }
Now, my query let's say is mapped to the following function `@GraphQLQuery(name = "firstNPersons") public List getFirstNPersons(@GraphQLArgument(name = "count") int count) {
List result = new ArrayList<>();
How do I get the executionResult variable in my GraphQLQuery.
I have skimmed through the documentation and issues, but not able to find the answer.
On a side note, we are thinking of integrating one of our major services to graphQL, only some APIs. So, I stumbled across this project. Looks like the project is using the standard GraphQL specification, but still there's lesser community involvement. Should we go ahead with the library or rather implement graphQL from scratch. As I see it, the only benefit this library is giving is to generate the schema file automatically.