Skip to content

Make deprecated introspection optional for legacy servers - #1849

Open
johnxy84 wants to merge 7 commits into
webonyx:masterfrom
johnxy84:master
Open

Make deprecated introspection optional for legacy servers#1849
johnxy84 wants to merge 7 commits into
webonyx:masterfrom
johnxy84:master

Conversation

@johnxy84

@johnxy84 johnxy84 commented Feb 6, 2026

Copy link
Copy Markdown
  • Add includeDeprecated option to Introspection::getIntrospectionQuery() to omit deprecated args/fields for older spec compatibility.
  • Omit isDeprecated/deprecationReason and includeDeprecated arguments when disabled.
  • Harden BuildClientSchema to treat missing deprecationReason as null.
  • Add regression tests for the new behavior.

* - typeIsOneOf
* Include field `isOneOf` for types?
* Default: false
*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's keep this blank line

Comment thread tests/Type/IntrospectionTest.php Outdated
self::assertCount(0, $matches[0]);
}

/** @see it('excludes deprecated fields and indicators when disabled') */

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are there tests in graphql-js called exactly like this? If so, please provide links to them. If not, we can omit this comment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ohh, did not know that's how it worked, but no, this is not covered there. I'll take out the comment.

Comment thread CHANGELOG.md

### Changed

- Allow omitting deprecated introspection arguments/fields for legacy servers

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Allow omitting deprecated introspection arguments/fields for legacy servers
- Allow omitting deprecated introspection arguments/fields for legacy servers https://github.com/webonyx/graphql-php/pull/1849

spawnia added 3 commits July 20, 2026 12:20
# Conflicts:
#	CHANGELOG.md
#	src/Type/Introspection.php
#	tests/Type/IntrospectionTest.php
# Conflicts:
#	CHANGELOG.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes deprecation metadata in introspection optional to improve compatibility with legacy GraphQL servers and to support generating introspection results that omit deprecated schema members.

Changes:

  • Add includeDeprecated option to Introspection::getIntrospectionQuery() (and therefore Introspection::fromSchema()) to omit includeDeprecated arguments and isDeprecated/deprecationReason selections when disabled.
  • Harden BuildClientSchema to treat a missing deprecationReason key in introspection results as null.
  • Add regression tests verifying query generation and schema building behavior when deprecated entries are excluded.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/Utils/BuildClientSchemaTest.php Adds a regression test that BuildClientSchema can build from introspection with deprecated fields/enum values excluded.
tests/Type/IntrospectionTest.php Adds coverage ensuring the generated introspection query omits deprecated indicators and includeDeprecated arguments when disabled.
src/Utils/BuildClientSchema.php Makes enum/field deprecation reason parsing tolerant of missing keys in introspection results.
src/Type/Introspection.php Introduces includeDeprecated option to control whether deprecated-related selections/arguments are included in the query string.
CHANGELOG.md Documents the behavioral change under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants