Skip to content

Conversation

@jdolle
Copy link
Collaborator

@jdolle jdolle commented Nov 20, 2025

Description

Ref CONSOLE-1540

Showing a list of changes can be useful even for new or deleted schemas.

This change allows null to be passed to diff as either the old and/or new schema.

Currently, on Hive, checking a new schema shows "no changes". This isn't harmful since additions are safe, but it's confusing. Showing a full list of additions in the new schema would make much more sense.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

See unit tests

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

💻 Website Preview

The latest changes are available as preview in: https://pr-2923.graphql-inspector.pages.dev

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-inspector/action 5.0.16-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/cli 6.0.4-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/audit-command 5.0.16-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/coverage-command 6.1.10-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/diff-command 6.0.4-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/introspect-command 5.0.16-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/similar-command 5.0.16-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/validate-command 5.0.16-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/core 7.1.0-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎
@graphql-inspector/patch 0.1.0-alpha-20251210220709-671f8b3cdccca39e371f19a9a1cbf9a8ed76eac6 npm ↗︎ unpkg ↗︎

Object.values(oldSchema.getTypeMap()).filter(t => !isPrimitive(t)),
Object.values(newSchema.getTypeMap()).filter(t => !isPrimitive(t)),
Object.values(oldSchema?.getTypeMap() ?? {}).filter(
t => !isPrimitive(t) && !isForIntrospection(t),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to exclude these introspection types. Otherwise they'll show as "added" if null is passed as the oldSchema.

Before, both oldSchema and newSchema contained identical types and so no changes were output.

@jdolle jdolle requested a review from n1ru4l November 21, 2025 18:11
@jdolle jdolle self-assigned this Nov 21, 2025
Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

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

See https://github.com/graphql-hive/graphql-inspector/pull/2923/files#r2605625304

I am fine with doing a major release, it is just a number to me. 🤷
Some people might complain about doing this a minot, but I am also fine with taking that risk.

@jdolle jdolle merged commit 9bfc094 into master Dec 10, 2025
6 of 8 checks passed
@jdolle jdolle deleted the diff-null-schemas branch December 10, 2025 22:07
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.

2 participants