Macroz / GraphQLviz

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

Introspection query returns outer "data" element #2

Closed MartinLorensen closed 8 years ago

MartinLorensen commented 8 years ago

Hi,

It seems the introspection query returns a "data" element contaning the "schema", where as the load-schema function expect the schema to be the outer most key.

The workaround is to just strip the "data" dictionary by hand (or a simple script).

{ "data": { "__schema": { ... } } }

Macroz commented 8 years ago

Hi!

I have one other report of this behavior. What backend are you using? We are using OpenTripPlanner in our project, where we implemented this ourselves using graphl-java , so maybe it's not exactly same with everything else. I'll look into it.

-Markku

MartinLorensen commented 8 years ago

We are using a fork of GraphQL-dotnet. And since the build-in introspection query doesn't support authentication, I am using a self-brewed command-line tool to actually dump the query output. However, it does look the same when using GraphiQL using your resource-intrespection-query.

Looking at graphql.org, it does look like any query (which introspection query is just a special case of) would return a dictionary with a single "data" key.

Macroz commented 8 years ago

After a quick look I dump the result after stripping away the "data" key. So maybe I should dump with the data key and strip it after loading from the file.

Macroz commented 8 years ago

Ok, I changed so that the file contains now the "data" key as well. Should make it easier to provide your own file. This is in version 0.3.0.

Macroz commented 8 years ago

You can also check this with the 0.4.0 that I just released.

MartinLorensen commented 8 years ago

Forgot to say this solved our problem! Thanks!