ExpediaGroup / graphql-kotlin

Libraries for running GraphQL in Kotlin
https://opensource.expediagroup.com/graphql-kotlin/
Apache License 2.0
1.74k stars 348 forks source link

Build plugins should allow configuring max parse tokens #1526

Closed dariuszkuc closed 2 years ago

dariuszkuc commented 2 years ago

Generate SDL task/mojo currently do not allow configuring this option and instead rely on the defaults provided by graphql-java. Since it is possible to configure this option when build a GraphQL server, we should also allow configuring it in build plugins.

@dariuszkuc I just saw this coming back with graphql-kotlin version 6.2.1. That version depends on graphql-java 19.1 which does allow to configure the maxTokens in ParserOptions, but I do not see that option being exposed by the Gradle plugin. Am I missing something?

Originally posted by @sschuberth in https://github.com/ExpediaGroup/graphql-kotlin/issues/1303#issuecomment-1222215513

samuelAndalon commented 2 years ago

we have 2 options:

  1. Manually set the default parser options ParserOptions.setDefaultParserOptions(ParserOptions.newParserOptions().maxTokens(<YOUR_NEW_VALUE>).build())
  2. specify parserOptions in the GraphQLContext https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/ParseAndValidate.java#L64
dariuszkuc commented 2 years ago

@samuelAndalon yes thats how you configure it on the server, this issue is about the build plugin allowing this configuration to generate the SDL

sschuberth commented 2 years ago

Indeed, it would be nice if the whole ParserOptions would be exposed as a Gradle plugin extension, so things like maxToken can easily be set from the Gradle build script DSL.

sschuberth commented 2 years ago

Just a friendly ping to @dariuszkuc: Is this planned to be worked on any time soon? It currently blocks us from using GitHub's GraphQL schema with the latest version of this plugin, which we'd like to take into use for Ktor 2 support.