Open zvictor opened 2 years ago
Gql-generator goes into infinite recursiveness once we add just 2 lines of code to the end of example/sampleTypeDef.graphql! CC @RvanderLaan
example/sampleTypeDef.graphql
Steps to reproduce:
type Query { user(id: Int!): User! members: [Member!] @deprecated(reason: "Test a deprecated query") }
type Mutation { signup( email: String! username: String! password: String! ): UserToken!
signin( email: String! password: String! ): String! setConfig( prefs: PrefsInput ): Config! sendMessage( message: String! ): String! @deprecated(reason: "Test a deprecated mutation")
}
input PrefsInput { language: String! }
type Config { language: String! level(domain: String!): Int! lastSeen(domain: String!): Int! theme(domain: String!): Int! }
type Subscription { UserUpdated(UserId: Int!): User }
type UserToken { token: String! user: User! }
type User { id: Int! username: String! email: String! createdAt: String! context: Context! details: UserDetails! address: String! @deprecated(reason: "Test a deprecated field") }
union UserDetails = Guest | Member | Premium
type Guest { region(language: String): String! }
type Member { address: String! }
type Premium { location: String! card: Card! }
type Card { number: String! type: [CardType!]! owner: User! # <------------------ ADDED --------------------- }
type CardType { key: String! }
type Context { user: User! # Circular ref domain: String! card: Card! # <------------------ ADDED --------------------- }
2. Run the tests or just `node index.js --schemaFilePath ./example/sampleTypeDef.graphql --destDirPath ./example/output`
I think I solved it! š @timqian please decide on #59 so that I can base the solution for this issue on that refactoring or not. Once #59 is merged I will push the fix for this one š
Gql-generator goes into infinite recursiveness once we add just 2 lines of code to the end of
example/sampleTypeDef.graphql
! CC @RvanderLaanSteps to reproduce:
example/sampleTypeDef.graphql
:type Mutation { signup( email: String! username: String! password: String! ): UserToken!
}
input PrefsInput { language: String! }
type Config { language: String! level(domain: String!): Int! lastSeen(domain: String!): Int! theme(domain: String!): Int! }
type Subscription { UserUpdated(UserId: Int!): User }
type UserToken { token: String! user: User! }
type User { id: Int! username: String! email: String! createdAt: String! context: Context! details: UserDetails! address: String! @deprecated(reason: "Test a deprecated field") }
union UserDetails = Guest | Member | Premium
type Guest { region(language: String): String! }
type Member { address: String! }
type Premium { location: String! card: Card! }
type Card { number: String! type: [CardType!]! owner: User! # <------------------ ADDED --------------------- }
type CardType { key: String! }
type Context { user: User! # Circular ref domain: String! card: Card! # <------------------ ADDED --------------------- }