A command line utility for converting a JSON GraphQL schema to GraphQL SDL.
This is useful when you only have a JSON GraphQL schema (e.g. from a code-first GraphQL library that can only produce schemas as .json
files) but you need an SDL schema (i.e. .graphql
file) for other tooling.
Fields from the JSON schema are sorted before writing the SDL file. This allows for consistent SDL output even when using a GraphQL library that produces JSON schemas with nondeterministic field order.
$ graphql-json-to-sdl SRC OUT
- SRC: The JSON GraphQL schema to convert
- OUT: The output file
-h
,--help
: show CLI help-v
,--version
: show CLI version
$ graphql-json-to-sdl ./schema.json ./schema.graphql
Install dependencies with:
$ yarn install
To run tests:
$ yarn test
You can also run the CLI in dev mode. For example:
$ ./bin/run --help