Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScoutEnhancer::enhanceBuilder() improvements to be more similar to … #2429

Merged
merged 6 commits into from
Aug 4, 2023

Conversation

LastDragon-ru
Copy link
Contributor

ArgBuilderDirective: process all ScoutBuilderDirective directives and directives filter support.

  • Added or updated tests
  • Documented user facing changes
  • Updated CHANGELOG.md

Changes

Not sure why, but ScoutEnhancer::enhanceBuilder() use only first directive

foreach ($this->argumentsWithScoutBuilderDirectives as $argument) {
$scoutBuilderDirective = $argument
->directives
->first(Utils::instanceofMatcher(ScoutBuilderDirective::class));

This is contrary to how ArgBuilderDirective/FieldBuilderDirective directives works: ResolveInfo::enhanceBuilder() process all of them. So the PR makes ScoutEnhancer::enhanceBuilder() to process all ScoutBuilderDirective directives.

The PR also fix directives filter - the filter will be applied to ScoutBuilderDirective too.

Breaking changes

If someone passes $directiveFilter into ResolveInfo::enhanceBuilder() it may be need to update its declaration to accept \Nuwave\Lighthouse\Support\Contracts\ArgBuilderDirective|\Nuwave\Lighthouse\Scout\ScoutBuilderDirective.

LastDragon-ru and others added 3 commits August 1, 2023 11:23
…`ArgBuilderDirective`: process all `ScoutBuilderDirective` directives and directives filter support.
Copy link
Collaborator

@spawnia spawnia left a comment

Choose a reason for hiding this comment

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

Good change.

src/Execution/ResolveInfo.php Show resolved Hide resolved
src/Scout/ScoutEnhancer.php Show resolved Hide resolved
tests/Unit/Scout/ScoutEnhancerTest.php Outdated Show resolved Hide resolved
tests/Unit/Scout/ScoutEnhancerTest.php Outdated Show resolved Hide resolved
tests/Unit/Scout/ScoutEnhancerTest.php Outdated Show resolved Hide resolved
@spawnia spawnia added the enhancement A feature or improvement label Aug 1, 2023
@LastDragon-ru
Copy link
Contributor Author

Thanks, I will update PR tomorrow :)

@LastDragon-ru
Copy link
Contributor Author

Seems done

@spawnia spawnia merged commit a10ae46 into nuwave:master Aug 4, 2023
22 checks passed
@spawnia
Copy link
Collaborator

spawnia commented Aug 4, 2023

Thank you, released with https://github.com/nuwave/lighthouse/releases/tag/v6.16.0.

@LastDragon-ru
Copy link
Contributor Author

Cool, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants