Open marhel opened 7 years ago
As a side note, the --schema
argument to relay-compiler can now take a schema in json format, but does expect the top level "data" node to be present.
This looks really useful!
Whilst this seems useful, perhaps it'd be better to have a convert-graphql-schema tool instead, which works purely on local files?
This enables schema format conversions (.json <==> .graphql) without needing HTTP, which is useful if you already have the schema locally, but in the wrong format.
To convert a JSON schema to IDL format;
To convert a IDL schema to JSON format;
It's pointless to run on JSON schema with
--json
as this effectively just doesJSON.stringify(JSON.parse(data))
. To run on an IDL schema without--json
, runs the introspection query on the IDL schema, and then converts that back to IDL, which is also rather pointless.Note that relative paths in the
file:
protocol are non-standard, but are allowed by url.parse as long as the double slashes after the colon are also omitted. Properly formatted file:-urls also work fine;