Skip to content

Commit 40ea03c

Browse files
authored
Merge pull request #158 from bsara/json-property-order
Reordered properties in JSON response according to recommendation in GraphQL spec
2 parents 6ca8225 + 66bd5f7 commit 40ea03c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/graphql/servlet/GraphQLObjectMapper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ public Map<String, Object> convertSanitizedExecutionResult(ExecutionResult execu
129129
public Map<String, Object> convertSanitizedExecutionResult(ExecutionResult executionResult, boolean includeData) {
130130
final Map<String, Object> result = new LinkedHashMap<>();
131131

132-
if(includeData) {
133-
result.put("data", executionResult.getData());
134-
}
135-
136132
if (areErrorsPresent(executionResult)) {
137133
result.put("errors", executionResult.getErrors());
138134
}
@@ -141,6 +137,10 @@ public Map<String, Object> convertSanitizedExecutionResult(ExecutionResult execu
141137
result.put("extensions", executionResult.getExtensions());
142138
}
143139

140+
if(includeData) {
141+
result.put("data", executionResult.getData());
142+
}
143+
144144
return result;
145145
}
146146

0 commit comments

Comments
 (0)