Skip to content

Proxy Container & Invoker #15

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

leon0399
Copy link

@leon0399 leon0399 commented Oct 3, 2024

Without proxying the container & invoker, all container binding resolution was performed in the "root" scope. This led to the invoker being unable to resolve scope-dependent arguments:

#[QueryField(name: 'customer')]
public function getCustomer(
  #[Argument(type: 'ID!')]
  string $id,
  ActorInterface $actor, // https://spiral.dev/docs/security-authentication/current
): Customer {
  ...
}

Without these changes, it would lead to Can't resolve 'ActorInterface' exception

See andrey-mokhov/graphql-php#60

@leon0399 leon0399 force-pushed the feature/proxy-container branch from d33ebbe to 2fa9811 Compare October 7, 2024 19:28
@leon0399 leon0399 marked this pull request as ready for review October 7, 2024 19:33
chore(deps): bump minimal framework version
): ServerConfig {
$serverConfig = (new ServerConfig())->setSchema($schema);

$scope = Proxy::create(
Copy link
Owner

Choose a reason for hiding this comment

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

Psalm ругается:
InternalClass: Spiral\Core\Internal\Proxy is internal to Spiral but called from Andi\GraphQL\Spiral\Bootloader\GraphQLBootloader

предлагаю рассмотреть вариант, который я предлагал изначально - создать соответствующие слои с атрибутом Proxy

Copy link
Author

Choose a reason for hiding this comment

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

Так же будет ругаться:
image

Copy link
Owner

Choose a reason for hiding this comment

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

ну в этом случае не получится принять MR, т.к. атрибут и поведение к нему экспериментальные, ты можешь в своём проекте вместо библиотечных свои мидлвары подсунуть с выставленными атрибутами

могу чем-то ещё помочь?

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