Skip to content
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

buildSchema triggers infinite recursion on Input types with self reference fields that have default values #2661

Closed
IvanGoncharov opened this issue Jun 16, 2020 · 1 comment
Labels
Milestone

Comments

@IvanGoncharov
Copy link
Member

Patch to reproduce:

diff --git a/src/utilities/__tests__/buildASTSchema-test.js b/src/utilities/__tests__/buildASTSchema-test.js
index 1d74e356..0b773a0b 100644
--- a/src/utilities/__tests__/buildASTSchema-test.js
+++ b/src/utilities/__tests__/buildASTSchema-test.js
@@ -287,6 +287,16 @@ describe('Schema Builder', () => {
     expect(cycleSDL(sdl)).to.equal(sdl);
   });

+  it('Recursive type', () => {
+    const sdl = dedent`
+      input SomeInput {
+        str: String
+        recurse: SomeInput = { str: "foo" }
+      }
+    `;
+    expect(cycleSDL(sdl)).to.equal(sdl);
+  });
+
   it('Two types circular', () => {
     const sdl = dedent`
       type TypeOne {
@IvanGoncharov IvanGoncharov added this to the post-16.0.0 milestone Aug 13, 2020
@JoviDeCroock
Copy link
Member

Fixed in #3810

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

2 participants