Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL Extensions #67

Open
bkuberek opened this issue Oct 15, 2019 · 1 comment
Open

GraphQL Extensions #67

bkuberek opened this issue Oct 15, 2019 · 1 comment

Comments

@bkuberek
Copy link
Member

bkuberek commented Oct 15, 2019

Regarding execution of graphql here:

Map<String, Object> result = new HashMap<>();
if (executionResult.getErrors().size() > 0) {
result.put(GRAPHQL_RESPONSE_ERROR_KEY, executionResult.getErrors());
logger.error("Errors: {}", executionResult.getErrors());
} else {
result.put(GRAPHQL_RESPONSE_DATA_KEY, executionResult.getData());
}
exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/json");
exchange.setStatusCode(StatusCodes.OK);
exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(result));

GraphQL also provides an extensions, perhaps we should add it.

    if (executionResult.getExtensions().size() > 0) {
      result.put("extensions", executionResult.getExtensions());
    }
@stevehu
Copy link
Contributor

stevehu commented Oct 16, 2019

@bkuberek Yes. It is a good idea. Could you please submit a PR? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants