File tree 1 file changed +6
-2
lines changed
graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ class CodeGen(private val config: CodeGenConfig) {
62
62
63
63
companion object {
64
64
private const val SDL_MAX_ALLOWED_SCHEMA_TOKENS : Int = Int .MAX_VALUE
65
+ private const val SDL_MAX_CHARACTERS : Int = Int .MAX_VALUE
65
66
private val logger: Logger = LoggerFactory .getLogger(CodeGen ::class .java)
66
67
}
67
68
@@ -112,7 +113,10 @@ class CodeGen(private val config: CodeGenConfig) {
112
113
*/
113
114
private fun buildDocument (): Document {
114
115
val options = ParserOptions .getDefaultParserOptions().transform { builder ->
115
- builder.maxTokens(SDL_MAX_ALLOWED_SCHEMA_TOKENS ).maxWhitespaceTokens(SDL_MAX_ALLOWED_SCHEMA_TOKENS )
116
+ builder
117
+ .maxTokens(SDL_MAX_ALLOWED_SCHEMA_TOKENS )
118
+ .maxWhitespaceTokens(SDL_MAX_ALLOWED_SCHEMA_TOKENS )
119
+ .maxCharacters(SDL_MAX_CHARACTERS )
116
120
}
117
121
val parser = Parser ()
118
122
@@ -139,7 +143,7 @@ class CodeGen(private val config: CodeGenConfig) {
139
143
parser.parseDocument(parserEnv)
140
144
} catch (exception: InvalidSyntaxException ) {
141
145
// check if the schema is empty
142
- if (exception.sourcePreview == null || exception.sourcePreview.isBlank()) {
146
+ if (exception.sourcePreview != null && exception.sourcePreview.isBlank()) {
143
147
logger.warn(" Schema is empty" )
144
148
// return an empty document
145
149
return Document .newDocument().build()
You can’t perform that action at this time.
0 commit comments