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

format_error should return locations as a list of {"line", "column"} #62

Merged
merged 3 commits into from
Sep 25, 2019

Conversation

ktosiek
Copy link
Contributor

@ktosiek ktosiek commented Sep 16, 2019

Fix for #61. This way a simple json.dumps() of format_error(...) should generate correct locations.

I've left GraphQLError.__eq__ as is, but maybe it should compare dicts to self.formatted?

@ktosiek ktosiek requested a review from Cito as a code owner September 16, 2019 18:45
Copy link
Member

@Cito Cito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for sending the PR.

Maybe we should add an __eq__ method to SourceLocation that would also allow comparison with a dict (similar to the __eq__ method of GraphQLError). And while being at it, we could also add a custom @property formatted(): return dict(line=self.line, column=self.column) to SourceLocation that would return an ordinary dict and could be used in format_error.

@ktosiek ktosiek requested a review from Cito September 23, 2019 20:05
@ktosiek
Copy link
Contributor Author

ktosiek commented Sep 24, 2019

codecov doesn't like the SourceLocation.__ne__ method being untested. Should I add explicit tests for __eq__ and __ne__?

Copy link
Member

@Cito Cito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codecov doesn't like the SourceLocation.__ne__ method being untested. Should I add explicit tests for __eq__ and __ne__?

Thtat should do no harm :)

@ktosiek ktosiek force-pushed the source-location-formatting branch from a5f09da to de0b14f Compare September 25, 2019 17:30
@Cito Cito merged commit ca0f9e6 into graphql-python:master Sep 25, 2019
@Cito
Copy link
Member

Cito commented Sep 25, 2019

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants