aryzing
aryzing

Reputation: 5857

Is it possible to recreate `schema.graphql` file from a schema uploaded to Apollo Engine?

After having pushed a schema to Apollo Engine, is it possible to recreate the schema.graphql that was used to push the schema in the first place?

It seems that the best I can get is a JSON version of the schema with obtained with apollo client:download-schema.

Upvotes: 0

Views: 94

Answers (1)

Daniel Rearden
Daniel Rearden

Reputation: 84687

You can turn any schema introspection result into SDL using the core library:

const { buildClientSchema, printSchema } = require('graphql')
const introspectionResult = require('./schema.json')

const schema = buildClientSchema(introspectionResult)
const sdl = printSchema(schema)

Upvotes: 1

Related Questions