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.
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.
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?