Skip to content

Input type cannot be recursive from version 6.1 #450

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

Closed
heerzhang opened this issue Oct 16, 2020 · 2 comments
Closed

Input type cannot be recursive from version 6.1 #450

heerzhang opened this issue Oct 16, 2020 · 2 comments
Labels

Comments

@heerzhang
Copy link

heerzhang commented Oct 16, 2020

stack overflow!!
my example: WhereTree nested recursive ;

enum LJ_TYPE { AND, OR, NOT, DSELF }

enum OPERATOR { EQ,NE,GE,LE,GT,LT,BTW,IN,LK,
  EMPTY,NULL,EXI,NEXI,TRUE,FALSE,NNULL,NEMPTY  }

input WhereLeaf { s:String, o:OPERATOR, l:ExpressItem, r:ExpressItem,
  sv:String, sa:[String], dt:String, dv:Float, lv:Int,
  dta:[String], da:[Float], la:[Int]
}

input WhereTree { lj:LJ_TYPE,  a:WhereLeaf, as:[WhereLeaf],
  w:WhereTree, ws:[WhereTree], sup:WhereTree
}

input ExpressItem {
  y:String, l:ExpressItem, r:ExpressItem, s:String,
  sub:SubSelect, cwt:[CaseExpression], a:[ExpressItem],
  sv:String, lv:Int, dv:Float, dt:String,
  bv:Boolean, len:Int
}

input SubSelect {
  s:String, e:ExpressItem,  from:String,
  where: WhereTree,  grp:[ExpressItem], hav:WhereTree
}

input CaseExpression {
  w:ExpressItem,  b: WhereTree,   t:ExpressItem
}

extend type Query {
  findAllEQPsFilter_delete(where: WhereTree, offset:Int, first:Int, orderBy:String, asc:Boolean): [EQP]!
}

WhereTree can not use NOW!

@vojtapol vojtapol added the bug label Oct 16, 2020
@KammererTob
Copy link
Contributor

Probably fixed with #414

@oryan-block
Copy link
Collaborator

A simplified version of this works:

class TempTest {
    @Test
    fun test() {
        val schema = SchemaParser.newParser()
                .resolvers(Query())
                .schemaString(
                        """
                    input WhereLeaf {
                        l: ExpressItem
                    }
                    
                    input WhereTree {
                        a:WhereLeaf,
                        as:[WhereLeaf]
                    }
                    
                    input ExpressItem {
                        l:ExpressItem, 
                        sub:SubSelect, 
                        cwt:[CaseExpression], 
                        a:[ExpressItem]
                    }
                    
                    input SubSelect {
                        e:ExpressItem,  
                        where: WhereTree,  
                        grp:[ExpressItem], 
                        hav:WhereTree
                    }
                    
                    input CaseExpression {
                        w:ExpressItem,  b: WhereTree
                    }
                    
                    type Query {
                        find(where: WhereTree): Int
                    }
                    """)
                .build()
                .makeExecutableSchema()

        assertNotNull(schema)
    }

    private class Query : GraphQLQueryResolver { fun find(where: WhereTree): Int = 0 }
    data class WhereTree(val a: WhereLeaf, val `as`: List<WhereLeaf>)
    data class WhereLeaf(val l: ExpressItem)
    data class ExpressItem(val l: ExpressItem?, val sub: SubSelect, val cwt: List<CaseExpression>, val a: List<ExpressItem>)
    data class SubSelect(val e: ExpressItem, val where: WhereTree, val grp: List<ExpressItem>, val hav: WhereTree)
    data class CaseExpression(val w: ExpressItem, val b: WhereTree)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants