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-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/cli 6.0.4-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/audit-command 5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/coverage-command 6.1.10-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/diff-command 6.0.4-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/introspect-command 5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/similar-command 5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/validate-command 5.0.16-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 npm ↗︎ unpkg ↗︎
@graphql-inspector/core 7.1.0-alpha-20251120235634-88fd4e9a4cbe3ef4792bdd0a808b897ac20ae425 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
"message": "Schema query root has changed from 'unknown' to 'Query'",
"meta": {
"newQueryTypeName": "Query",
"oldQueryTypeName": "unknown",
Copy link
Collaborator

@n1ru4l n1ru4l Nov 21, 2025

Choose a reason for hiding this comment

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

Isn't unknown also a legit name that the root Query type could be named after? Maybe it should be null and not a string instead.

type unknown {
  foo: Int
}

schema {
  query: unknown
}

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