Skip to content

Commit

Permalink
Merge pull request #275 from Netflix/update-token-limit
Browse files Browse the repository at this point in the history
Update the schema token limit to INT.MAX_VALUE.
  • Loading branch information
srinivasankavitha authored Nov 11, 2021
2 parents 6c51f2b + 5782c91 commit ea0e317
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.squareup.javapoet.JavaFile
import com.squareup.kotlinpoet.FileSpec
import graphql.language.*
import graphql.parser.Parser
import graphql.parser.ParserOptions
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths
Expand Down Expand Up @@ -80,6 +81,12 @@ class CodeGen(private val config: CodeGenConfig) {
}

private fun generateForSchema(schema: String): CodeGenResult {
val SDL_MAX_ALLOWED_SCHEMA_TOKENS: Int = Int.MAX_VALUE
val parserOptions = ParserOptions.getDefaultParserOptions()
.transform {
it.maxTokens(SDL_MAX_ALLOWED_SCHEMA_TOKENS)
}
ParserOptions.setDefaultParserOptions(parserOptions)
document = Parser.parse(schema)
requiredTypeCollector = RequiredTypeCollector(
document,
Expand Down

0 comments on commit ea0e317

Please sign in to comment.