Macroz / GraphQLviz

GraphQLviz marries GraphQL (schemas) with Graphviz.
Eclipse Public License 1.0
116 stars 6 forks source link

GraphQLviz Build Status

GraphQLviz marries GraphQL (schemas) with Graphviz.

It's a tool to show you what your schema really looks like. At the moment, it's mostly useful as a complement to GraphiQL, like printing a huge poster size version to facilitate team discussions.

Quick Usage

Requires Graphviz and Java Virtual Machine.

There is a convenient uberjar release available to download from the release page.

Once you have Graphviz, Java and the uberjar, then you can use GraphQLviz like a regular Java app like so:

java -jar graphqlviz.jar https://api.digitransit.fi/routing/v1/routers/finland/index/graphql digitransit

Example schema (from Digitransit)

Example graph

Run java -jar graphqlviz.jar --help for more options or read the Full Usage.

Full Usage

You must have Graphviz executable from command-line. Download and install it using your package manager or go to Graphviz.

You also need Leiningen. Leiningen is the Clojure build tool that runs on the Java Virtual Machine. This means you also need Java.

If you like to use Leiningen, you can run like this:

lein run https://api.digitransit.fi/routing/v1/routers/finland/index/graphql digitransit

There is a prepackaged jar in Clojars so you don't have to build GraphQLviz yourself.

Also there is a convenient uberjar release available to download from the release page.

With these JAR files you can run like this:

java -jar graphqlviz.jar https://api.digitransit.fi/routing/v1/routers/finland/index/graphql digitransit

If you want to use the code from Clojure, perhaps from your own program, add to your project.clj:

Clojars Project

Separate introspection

Instead of running against a live GraphQL server, you can use a downloaded result of an introspection query like this:

java -jar graphqlviz.jar examples/digitransit.json digitransit

Otherwise, in the case of a URL, the introspection query is executed against the GraphQL endpoint and the results visualized.

Authentication

Since 0.4.0, you can pass options for authenticating with the server for the introspection query (-a or --auth).

The supported authentication types are basic, digest (with user and password) as well as oauth2 (with oauth token) See also -h for help.

java -jar graphqlviz.jar http://secret.example.com/graphql secret-schema-name -abasic -utester -ppassword

Or with password prompt -pp or --password-prompt (since 0.5.0).

java -jar graphqlviz.jar http://secret.example.com/graphql secret-schema-name -abasic -utester --password-prompt

Backlog

License

Copyright © 2015-2017 Markku Rontu

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.