Skip to content

add more information on union fields being removed #2838

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

egoodwinx
Copy link
Contributor

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

These integration tests will need to be updated as well for hive:

https://github.com/graphql-hive/console/blob/10f91e2f956fb96bd5abfa250ab0197e9891f975/integration-tests/tests/api/schema/delete.spec.ts#L212

https://github.com/graphql-hive/console/blob/10f91e2f956fb96bd5abfa250ab0197e9891f975/packages/services/api/src/modules/alerts/providers/adapters/msteams.spec.ts#L55

Description

Updated removal field text to be:
Removing a field is a breaking change. It is preferable to deprecate the field before removing it. This applies removed union fields as well as it affects the __typename field which can break your GraphQL consumers.

Fixes # graphql-hive/console#6125

Type of change

Please delete options that are not relevant.

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

Screenshots/Sandbox (if appropriate/relevant):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take
action on it as appropriate

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

  • pnpm test

Test Environment:

  • OS: Windows
  • @graphql-inspector/...:
  • NodeJS: v22.12.0

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

Copy link

changeset-bot bot commented Jan 8, 2025

🦋 Changeset detected

Latest commit: 960183c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@graphql-inspector/core Minor
@graphql-inspector/action Patch
@graphql-inspector/audit-command Patch
@graphql-inspector/coverage-command Patch
@graphql-inspector/diff-command Patch
@graphql-inspector/introspect-command Patch
@graphql-inspector/similar-command Patch
@graphql-inspector/validate-command Patch
@graphql-inspector/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -39,7 +39,7 @@ export function fieldRemovedFromMeta(args: FieldRemovedChange) {
level: CriticalityLevel.Breaking,
reason: args.meta.isRemovedFieldDeprecated
? `Removing a deprecated field is a breaking change. Before removing it, you may want to look at the field's usage to see the impact of removing the field.`
: `Removing a field is a breaking change. It is preferable to deprecate the field before removing it.`,
: `Removing a field is a breaking change. It is preferable to deprecate the field before removing it. This applies removed union fields as well as it affects the __typename field which can break your GraphQL consumers.`,
Copy link

@jdolle jdolle Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may still get questions about why consumers break. Prefer clarifying at least one of the specific cases:

This applies to removed union fields as well, since removal breaks client operations that contain fragments that reference the removed type. E.g. ...on RemovedType.

If there are other cases, then those can be mentioned too unless it gets to be too many.

Copy link
Contributor Author

@egoodwinx egoodwinx Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure can update, do you know what other cases there might be?

I think the case mentioned has to do with the __typename field since that could contain reference to the field even though there aren't references of the type itself.

@jdolle
Copy link

jdolle commented Feb 11, 2025

This looks good to me.
@n1ru4l @kamilkisiela Since this impacts hive-console, please review

@kamilkisiela
Copy link
Collaborator

Can you also add a changeset?

@egoodwinx egoodwinx marked this pull request as ready for review February 13, 2025 23:20
@n1ru4l n1ru4l merged commit 416a9ce into graphql-hive:master Feb 20, 2025
5 checks passed
@egoodwinx egoodwinx deleted the union-type-member-removal-description branch February 20, 2025 13:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants