Cayleygraph adaptor for GraphQL IDE
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
static
.gitignore
LICENSE
README.md
bindata_assetfs.go
build.sh
graphiql.go

README.md

cayley-graphiql

Cayley graph adaptor for Facebook's GraphQL IDE (including some of that project's code, so please also see their licence).

Full GraphQL is not supported, as Cayley's "GraphQL-inspired" language is used. This means that the "Documentation Explorer" section on the right of the IDE and "QUERY VARIABLES" section at the bottom of the IDE are redundant for their original use. It also means that the GraphQL validation code often marks valid Cayley-GraphQL-inspired-language as invalid ... which can be confusing initially.

Not everything works (there will probably be an error shown when you first start the page), but I've found it a useful basic tool for graph debugging when using Cayley as a library. It also demonstrates Cayley running in the browser and allows graph debuging in that context too.

The following query (from the Cayley docs) works well:

{
  nodes {
    id
    follows {
      id
    }
  }
}

To query the same testdata cayley graph in the browser, add the following JSON to the "QUERY VARIABLES" section of the ide:

{
  "pouchdb":"cayley_testdata"
}

See this running from a static web page here.

Whenever you provide a "pouchdb" database name, that database will be created in the browser if it does not exist. If that database has the name "cayley_testdata" then the testdata used in the Cayley documentation will be inserted (if not already present). To be able to see a PouchDB database you have previously created, static/index.html must be served from the same domain as that created database.

To see it in action on your own machine go run example/main.go then open your browser at the url reported.

If you want to hack, build.sh works on OSX. You will need GopherJS installed and will probably need to go get some missing libraries.

Enjoy! PRs welcome.