Skip to content

601 set schema parser max tokens to max int #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package graphql.kickstart.tools
import graphql.language.Definition
import graphql.language.Document
import graphql.parser.Parser
import graphql.parser.ParserOptions
import graphql.schema.GraphQLScalarType
import graphql.schema.idl.RuntimeWiring
import graphql.schema.idl.SchemaDirectiveWiring
import org.antlr.v4.runtime.RecognitionException
import org.antlr.v4.runtime.misc.ParseCancellationException
import kotlin.Int.Companion.MAX_VALUE
import kotlin.reflect.KClass

/**
Expand Down Expand Up @@ -169,7 +171,10 @@ class SchemaParserBuilder {
files.forEach { documents.add(parser.parseDocument(readFile(it), it)) }

if (schemaString.isNotEmpty()) {
documents.add(parser.parseDocument(schemaString.toString()))
val options = ParserOptions
.getDefaultParserOptions()
.transform { o -> o.maxTokens(MAX_VALUE) }
documents.add(parser.parseDocument(schemaString.toString(), options))
}
} catch (pce: ParseCancellationException) {
val cause = pce.cause
Expand Down