Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #409
Checklist
Description
I tried to fix #409 with this PR. Quick rundown of the problem and what my attempt to fix it was:
This commit 10ee43f tried to address #385 by using
GraphQLInputObjectTypes
instead of justGraphQLTypeReferences
. TheGraphQLInputObjectTypes
will be populated with a full list of field definitions, which in turn will createGraphQLInputObjectTypes
if necessary. The stackoverflow occured when a field needed to create aGraphQLInputObjectType
, which then would have a reference back to any ancestor in the creation chain. Since at that point the ancestor did not yet exist in theinputObjects
list the function tries to create it again, which restarts the whole chain.My fix: Instead of using
GraphQLInputObjectTypes
for everything we keep a list of all ancestors (called referencingInputObjects). If we then encounter a type which already is in this list we return aGraphQLTypeReference
instead of the fullGraphQLInputObjectType
again. This should hopefully allow #385 to still be functional, while also fixing #409, although i did not test, for that. So maybe someone more knowledgeable should have a look at the specific use-case of #385