Juniper: Merge schema language PR

Created on 29 Nov 2016  路  6Comments  路  Source: graphql-rust/juniper

After using the macros to define the schema, is it possible to retrieve the schema as a json document? A simple string would suffice. This would allow us to use a tool to automatically version the API using an external tool to analyze the schema.

Most helpful comment

I want to export the schema to the graphql client modules, but the graphql_client crate requires it in .graphql format. Is it possible to print it as .graphql format?

All 6 comments

Hello!

You can use the introspection query from https://github.com/graphql/graphiql/blob/master/src/utility/introspectionQueries.js#L15 to get a JSON representation of the schema. Either fire up a server with Iron and use the built-in GraphiQLHandler and GraphQLHandler or embed the query string in you application directly.

I want to export the schema to the graphql client modules, but the graphql_client crate requires it in .graphql format. Is it possible to print it as .graphql format?

In his recent talk @LegNeato had a code example at https://youtu.be/QXJ0wKBLt-8?t=1377 that does not seem to be implemented:

let schema = RootNode::new(Query, EmptyMutation::<()>::new());
println!("{}", schema.as_schema_language());

I cannot find this function anywhere, but it would be nice to have.

I believe this PR has the functionality https://github.com/graphql-rust/juniper/pull/324

Sorry, been lagging on merging it. Will get to it!

This has been merged.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thedodd picture thedodd  路  5Comments

projektir picture projektir  路  4Comments

theduke picture theduke  路  4Comments

snnsnn picture snnsnn  路  4Comments

tomhoule picture tomhoule  路  4Comments