Make deprecated introspection optional for legacy servers - #1849
Make deprecated introspection optional for legacy servers#1849johnxy84 wants to merge 7 commits into
Conversation
| * - typeIsOneOf | ||
| * Include field `isOneOf` for types? | ||
| * Default: false | ||
| * |
There was a problem hiding this comment.
Let's keep this blank line
| self::assertCount(0, $matches[0]); | ||
| } | ||
|
|
||
| /** @see it('excludes deprecated fields and indicators when disabled') */ |
There was a problem hiding this comment.
Are there tests in graphql-js called exactly like this? If so, please provide links to them. If not, we can omit this comment.
There was a problem hiding this comment.
Ohh, did not know that's how it worked, but no, this is not covered there. I'll take out the comment.
|
|
||
| ### Changed | ||
|
|
||
| - Allow omitting deprecated introspection arguments/fields for legacy servers |
There was a problem hiding this comment.
| - 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 |
# Conflicts: # CHANGELOG.md # src/Type/Introspection.php # tests/Type/IntrospectionTest.php
# Conflicts: # CHANGELOG.md
There was a problem hiding this comment.
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
includeDeprecatedoption toIntrospection::getIntrospectionQuery()(and thereforeIntrospection::fromSchema()) to omitincludeDeprecatedarguments andisDeprecated/deprecationReasonselections when disabled. - Harden
BuildClientSchemato treat a missingdeprecationReasonkey in introspection results asnull. - 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.
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
includeDeprecatedoption toIntrospection::getIntrospectionQuery()to omit deprecated args/fields for older spec compatibility.isDeprecated/deprecationReasonandincludeDeprecatedarguments when disabled.BuildClientSchemato treat missingdeprecationReasonas null.