feat: add GQL sigil to format and lint static GraphQL docs #1391
+63
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I got bit the other day by a syntax error in a GraphQL document in a module attribute of a test.
The error message I received sent me off in the wrong direction. I thought it'd be nice if there
was some way to lint those. Co-workers also thought it a nice idea plus formatting since Absinthe
only formats standalone .gql or .graphql files.
So here's a sigil that formats or prints validation errors to system error. Here's an example
output from one of the added tests:
Note: I limited the printing of validation errors only to the sigil. I wanted to put it in
Absinthe.Formatterhowever, I wanted to ensure there wasn't some backward compatibilityto be concerned with.