You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Interface ExecutionResult doesn't contain if data is present or not #1490
If an error was encountered before execution begins, the data entry should not be present in the result.
If an error was encountered during the execution that prevented a valid response, the data entry in the response should be null.
Which means there's a distinction between data being returned as null, or not being returned at all.
However, the interface ExecutionResult doesn't allow to distinguish the 2 cases, since the interface only allows to get the data (either null, or T), but not to verify if there was data there to start with. ExecutionResultImpl does have this information, but since it being internal, no other code should really be using it.
Here's an example of the problem:
public ExecutionResult from(GraphQLError error){
return new ExecutionResultImpl(error);
}
public ExecutionResult transformer(ExecutionResult result) {
// Doesn't actually transform anything
return new ExecutionResultImpl(result.getData(), result.getErrors(), result.getExtensions());
}
// from(someError).toSpecification() != transfomer(from(someError)).toSpecification()
So, to allow other libraries to do proper serialization based on just an ExecutionResult, isDataPresent should be part of the interface.
I've checked #552, and I think all it needs to be done is to bring the isDataPresent up to the interface, not just the implementation.
Activity
fcristovao commentedon Apr 9, 2019
Fixed by #1491