graphql-kotlin icon indicating copy to clipboard operation
graphql-kotlin copied to clipboard

Build plugins should allow configuring max parse tokens

Open dariuszkuc opened this issue 2 years ago • 3 comments

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

dariuszkuc avatar Aug 23 '22 00:08 dariuszkuc

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

samuelAndalon avatar Aug 23 '22 02:08 samuelAndalon

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

dariuszkuc avatar Aug 23 '22 02:08 dariuszkuc

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 avatar Sep 14 '22 10:09 sschuberth

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.

sschuberth avatar Oct 10 '22 11:10 sschuberth