Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Auto prettify #507

Closed
wants to merge 2 commits into from
Closed

Auto prettify #507

wants to merge 2 commits into from

Conversation

rybon
Copy link

@rybon rybon commented May 17, 2019

Dependent on graphql/graphiql#830

Extends the graphiql option to alternatively accept an object instead of a boolean. This object has a field called autoPrettify that when set to true will pass the autoPrettify prop to the GraphiQL component, that will in turn run the prettify method when it mounts. This means stripped GraphQL queries will automatically be pretty printed when opened in the GraphiQL editor.

@coveralls
Copy link

coveralls commented May 17, 2019

Coverage Status

Coverage increased (+0.001%) to 99.391% when pulling 4065322 on rybon:master into a17df73 on graphql:master.

@rybon
Copy link
Author

rybon commented May 17, 2019

@IvanGoncharov please review.

@IvanGoncharov
Copy link
Member

@rybon I have some minor review comments but the main issue here if GraphiQL maintainers will accept this fix or not.
If it's merged into GraphiQL I would happily help you to get this PR in shape and merge it.

@rybon
Copy link
Author

rybon commented May 17, 2019

Yes, I agree. Lets wait and see what they think. Thanks for your feedback!

IvanGoncharov added a commit to IvanGoncharov/express-graphql that referenced this pull request May 18, 2019
IvanGoncharov added a commit to IvanGoncharov/express-graphql that referenced this pull request May 18, 2019
IvanGoncharov added a commit to IvanGoncharov/express-graphql that referenced this pull request May 18, 2019
IvanGoncharov added a commit that referenced this pull request May 18, 2019
@IvanGoncharov
Copy link
Member

@rybon I liked your approach in this PR so I borrowed some ideas in #508.

@rybon
Copy link
Author

rybon commented May 18, 2019

Cool!

@rybon
Copy link
Author

rybon commented May 20, 2019

@IvanGoncharov following on the discussion in graphql/graphiql#830, would it be possible to extend the options object with a callback field that can be called on every query, so we can make use of the defaultQuery prop in GraphiQL? Something like: transformDefaultQuery: (query) => print(parse(queryFromUrlBar)), where we pass the result to the defaultQuery prop?

I'm curious what you think. I think I can make a PR that would look very similar to this one based on this approach.

@rybon rybon closed this May 20, 2019
@IvanGoncharov
Copy link
Member

@rybon I'm not sure about this proposal I need to think about it.

junminstorage pushed a commit to junminstorage/express-graphql that referenced this pull request Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants