2

I am using GraphQL on Scala via Sangria. Also I am using apollo-codegen.

I want to define my schema once, so I export my scheme from backend to frontend by:

schema.renderPretty

The problem is sangria's renderPretty prints schema in schemaAst format. But apollo-codegen expects json format.

How to make sangria render schema in json format? Or maybe painless convert schemaAst to json via SBT?

tenshi
  • 26,268
  • 8
  • 76
  • 90
Oleg
  • 899
  • 1
  • 8
  • 22

1 Answers1

5

I think you are referring to the introspection JSON. With Sangria you can get it by executing an introspection query:

Executor.execute(schema, sangria.introspection.introspectionQuery)
tenshi
  • 26,268
  • 8
  • 76
  • 90