Skip to content

Is there any way to ask GraphQLSchemaGenerator to write a local file in SDL after server start? #977

Answered by smyrick
RIP21 asked this question in Q&A
Discussion options

You must be logged in to vote

@RIP21 The GraphQLSchema bean is created automatically and can be used by any part of your application

https://expediagroup.github.io/graphql-kotlin/docs/spring-server/spring-beans

So you can have a start up bean that depends on on the schema bean and prints the schema to a file.

fun printToFile(schema: GraphQLSchema) {
    File(fileName).writeText(schema.print())
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RIP21
Comment options

Answer selected by RIP21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants