Transfer config in schema extender - #1672
Conversation
|
I just applied the codestyle fixes through #1674, please merge the latest |
# Conflicts: # src/Language/Lexer.php # src/Utils/BuildClientSchema.php # src/Utils/BuildSchema.php # src/Validator/Rules/QueryComplexity.php
There was a problem hiding this comment.
Pull request overview
Ensures custom field configuration added during schema building (e.g., via fieldConfigDecorator) is preserved when a schema is extended via SchemaExtender, enabling consumers (like custom executors) to read custom field attributes after extension.
Changes:
- Preserve existing
FieldDefinition::$configentries when rebuilding field configs during schema extension. - Add a regression test verifying custom field config keys are retained for existing fields and applied to newly-added extension fields.
- Minor formatting adjustments in tests around
/** @lang GraphQL */inline annotations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Utils/SchemaExtender.php |
Preserves original field config by merging (...$field->config) into the reconstructed field config during extension. |
tests/Utils/SchemaExtenderTest.php |
Adds coverage asserting custom field config keys survive schema extension and apply to extension-introduced fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $query /** @lang GraphQL */ | ||
| = '{ hello }'; |
| $query /** @lang GraphQL */ | ||
| = '{ hello }'; |
| $sdl /** @lang GraphQL */ | ||
| = ' |
| $extensionSdl /** @lang GraphQL */ | ||
| = ' |
| $query /** @lang GraphQL */ | ||
| = ' |
| $query /** @lang GraphQL */ | ||
| = ' |
| $query /** @lang GraphQL */ | ||
| = ' |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (7)
tests/Utils/SchemaExtenderTest.php:1738
- The
/** @lang GraphQL */annotation is placed between the variable and=so it no longer annotates the GraphQL string literal (IDE language injection typically requires the comment to be immediately before the string). Put the annotation back directly before the string.
$query /** @lang GraphQL */
= '{ hello }';
tests/Utils/SchemaExtenderTest.php:1775
- Same issue here:
/** @lang GraphQL */is no longer attached to the string literal when it appears between the variable name and=. Move it to directly precede the string to preserve GraphQL language injection.
$query /** @lang GraphQL */
= '{ hello }';
tests/Utils/SchemaExtenderTest.php:1784
/** @lang GraphQL */should be positioned immediately before the SDL string literal; placing it after$sdland before=prevents IDEs from treating the following string as GraphQL.
$sdl /** @lang GraphQL */
= '
tests/Utils/SchemaExtenderTest.php:1798
/** @lang GraphQL */is currently not attached to the string literal because it sits between the variable and assignment operator. Put it right before the string to keep SDL language injection working.
$extensionSdl /** @lang GraphQL */
= '
tests/Utils/SchemaExtenderTest.php:1930
- The
@lang GraphQLannotation should directly precede the string literal (not be separated onto the variable line). Move it so IDEs still recognize the query string as GraphQL.
$query /** @lang GraphQL */
= '
tests/Utils/SchemaExtenderTest.php:2039
- Here the
/** @lang GraphQL */comment is no longer annotating the query string literal due to being placed before=. Reattach it to the string literal so GraphQL injection continues to work.
$query /** @lang GraphQL */
= '
tests/Utils/SchemaExtenderTest.php:2098
- Same as above:
/** @lang GraphQL */should be immediately before the string literal; placing it between$queryand=breaks GraphQL language injection.
$query /** @lang GraphQL */
= '
Fixes #1671