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

Don't treat a non-null input type field changing to nullable input type field as a breaking change #35

Closed
RobertWSaunders opened this issue Feb 26, 2021 · 2 comments

Comments

@RobertWSaunders
Copy link

Overview

If an input type has a field that is non-null and that field is changing to a nullable field, we should not treat that as a breaking change but the gem currently does. It's not a breaking since any clients would already be supplying the input field, with the change they have the opportunity to not do that anymore.

@jturkel
Copy link
Contributor

jturkel commented Jul 22, 2021

@RobertWSaunders - I couldn't reproduce this problem with the following test case. Do you have a reproducible test case you could share?

old_schema_idl = <<~SCHEMA
  schema {
    query: Query
  }
  input Foo {
    bar: String!
  }
  type Query {
    a(foo: Foo!): String!
  }
SCHEMA

new_schema_idl = <<~SCHEMA
  schema {
    query: Query
  }
  input Foo {
    bar: String
  }
  type Query {
    a(foo: Foo!): String!
  }
SCHEMA

result = GraphQL::SchemaComparator.compare(old_schema_idl, new_schema_idl)

assert_equal ["Input field `Foo.bar` changed type from `String!` to `String`"], 
                       result.changes.map(&:message)

refute result.breaking?

@RobertWSaunders
Copy link
Author

Ah weird, maybe it's no longer an issue 👍 We can close this and re-open if it pops up again.

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

No branches or pull requests

2 participants