Oleg
Oleg

Reputation: 941

Scala. Sangria.Print json schema

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?

Upvotes: 2

Views: 760

Answers (1)

tenshi
tenshi

Reputation: 26576

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)

Upvotes: 5

Related Questions