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

Check 'ofType' of both sides when comparing non-null values #2122

Merged
merged 1 commit into from
Jul 6, 2022
Merged

Check 'ofType' of both sides when comparing non-null values #2122

merged 1 commit into from
Jul 6, 2022

Conversation

blakedovetail
Copy link
Contributor

Description

This fixes #2107 . The bug is reproducible when making a list type optional in an input type:

Original schema

input Foo {
    a: String!
    b: [String!]!
}

New schema

input Foo {
    a: String
    b: [String!]
}

Would yield

✔  Input field Foo.a changed type from String! to String
✖  Input field Foo.b changed type from [String!]! to [String!]

error Detected 1 breaking change

This should not be considered a breaking change.

This happened because what looks like an erroneous ternary statement in safeChangeForInputValue.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Screenshots/Sandbox (if appropriate/relevant):

N/A

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Run core/__tests__/input.ts#test('field made optional')
  • Run core/__tests__/input.ts#test('field made non-optional')

Test Environment:

  • OS: MacOS Monterey 12.4
  • NodeJS: 16.13.1

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

N/A

@vercel
Copy link

vercel bot commented Jun 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
graphql-inspector ✅ Ready (Inspect) Visit Preview Jul 6, 2022 at 3:19PM (UTC)

@kamilkisiela kamilkisiela merged commit 9789b27 into kamilkisiela:master Jul 6, 2022
@kamilkisiela kamilkisiela self-assigned this Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive when changing required input field to optional
2 participants