Closed
Description
SourceLocation
, as a NamedTuple, is serialized by json.dumps() to an array instead of an object. Graphql.js keeps SourceLocation
as and object, so it just works for them.
Reproduction:
from graphql import SourceLocation, GraphQLError, format_error, Source
import json
print(json.dumps(format_error(GraphQLError(message="test", source=Source('{ test }'), positions=[2]))))
Expected result: {"message": "test", "locations": [
{"line": 1, "column": 3}
], "path": null}
Actual result: {"message": "test", "locations": [
[1, 3]
], "path": null}
Should SourceLocation
be changed to something that serializes correctly? Or would it make more sense to convert it to dict in format_errors
?
Metadata
Metadata
Assignees
Labels
No labels