File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed 
graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen Expand file tree Collapse file tree 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) {
6262
6363    companion  object  {
6464        private  const  val  SDL_MAX_ALLOWED_SCHEMA_TOKENS :  Int  =  Int .MAX_VALUE 
65+         private  const  val  SDL_MAX_CHARACTERS :  Int  =  Int .MAX_VALUE 
6566        private  val  logger:  Logger  =  LoggerFactory .getLogger(CodeGen ::class .java)
6667    }
6768
@@ -112,7 +113,10 @@ class CodeGen(private val config: CodeGenConfig) {
112113     */  
113114    private  fun  buildDocument (): Document  {
114115        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 )
116120        }
117121        val  parser =  Parser ()
118122
@@ -139,7 +143,7 @@ class CodeGen(private val config: CodeGenConfig) {
139143                parser.parseDocument(parserEnv)
140144            } catch  (exception:  InvalidSyntaxException ) {
141145                //  check if the schema is empty
142-                 if  (exception.sourcePreview ==  null  ||  exception.sourcePreview.isBlank()) {
146+                 if  (exception.sourcePreview !=  null  &&  exception.sourcePreview.isBlank()) {
143147                    logger.warn(" Schema is empty" 
144148                    //  return an empty document
145149                    return  Document .newDocument().build()
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments