question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[umbrealla] use a true graphql prettifier (i.e., one designed for prettifying)

See original GitHub issue

Describe the bug There are a number of bugs that arise from our current approach to prettifying graphql:

To Reproduce

  1. Create a GraphQL request
  2. click Pretify GraphQL and observe the results

Expected behavior The above issues have different solutions, but the over-arching concept is that the prettifying should work as one might naturally expect (and definitely without destroying information).

I think we should look at other tools and graphql clients to see how they approach this problem and go with the most widely adopted solution. I believe prettier may be an option, but the docs are down at the time of writing this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dimitropouloscommented, Aug 31, 2021

@ariasmn I would love to see a PR for this!! You’d add it to the insomnia-app package and run it using the prettier API (https://prettier.io/docs/en/api.html).

Lemme know how I can help!

1reaction
ariasmncommented, Jul 16, 2021

Hi!

I have (kinda) looked into it, and the problem with the comments comes from the Javascript GraphQL library AST, since it can’t parse comments. If they implement it, making a small library to correctly prettify the code should not be much of a problem, but modifying the parser is out of my league sadly.

My guess is that the one from mtp.tools is using a whole different GraphQL AST that parse comments correctly.

I hope that this information helps you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL schema basics
This article describes the fundamental building blocks of a schema and how to create one for your GraphQL server. The schema definition language....
Read more >
GraphQL Formatter and GraphQL Beautifier free and easy to use
GraphQL Formatter Online helps to prettier your GraphQL queries data. It's a pretty simple and easy way to read GraphQL Data and Share...
Read more >
GraphQL Code Libraries, Tools and Services
A powerful JavaScript GraphQL client, designed to work well with React, React Native, ... Real-Time with GraphQL for any GraphQL schema or transport....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found