graphql-dotnet / relay

A toolset for creating Relay.js compatible GraphQL servers in dotnet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get schema.json file

MapleYe opened this issue · comments

I'd like to know how to create schema.json file. Thank you.

You need to build one, by running an introspection query against your schema and writing the result out. See https://github.com/graphql-dotnet/relay/blob/master/src/GraphQL.Relay.Todo/SchemaWriter.cs

There isn't really a generic way to handle this tho because you need to actually construct your schema which may mean mocking out dependencies depending on your DI setup

Thanks for the answer. Currently I'm using get-graphql-schema to build the schema file for Relay Modern. As you said, that package fetches an introspection query from the GraphQL server.

I managed to get the schema file using graphql-cli.

See this SO answer: Get GraphQL whole schema query