You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The app fails on _validate_directive_implementation(self) with the error message Directive Auth Method on_schema_subscription is not an Async Generator.
It works if I decorate the on_schema_subscription as a @staticmethod
Looking more in detail into the called method is_valid_async_generator(generator: AsyncGenerator), it receives my method as a <bound method Auth.on_schema_subscription of <*******.directives.auth.auth object at 0x7f5a24a09610>>
The valid_async_generator of Tartiflette does:
isasyncgenfunction(
generator if isfunction(generator) else generator.__call__
)
Reproducing the logic gives:
# generator = my <bound method ****.on_schema_subscription>
isfunction(generator) = False
# so it tries with the generator.__call__
isasyncgenfunction(generator.__call__) = False
# but if I check by giving directly the generator without the isfunction check
isasyncgenfunction(generator) = True
You can run it in an environment with the requirements installed with python -m src
It will fail to run if you don't remove the comment on @staticmethod in src.directives.Auth.on_schema_subscription
Tartiflette version: 1.1.1
Python version: 3.7
Executed in docker: No
The text was updated successfully, but these errors were encountered:
Issue
Tried implementing the on_schema_subscription as shown on the documentation: https://tartiflette.io/docs/api/directive
The app fails on
_validate_directive_implementation(self)
with the error messageDirective Auth Method on_schema_subscription is not an Async Generator
.It works if I decorate the on_schema_subscription as a
@staticmethod
Related issue: #346
Debug
Looking more in detail into the called method
is_valid_async_generator(generator: AsyncGenerator)
, it receives my method as a<bound method Auth.on_schema_subscription of <*******.directives.auth.auth object at 0x7f5a24a09610>>
The valid_async_generator of Tartiflette does:
Reproducing the logic gives:
So that explains my error
Reproduce it
Here's a simplified version of the code I'm testing issue-directive.zip
You can run it in an environment with the requirements installed with
python -m src
It will fail to run if you don't remove the comment on @staticmethod in src.directives.Auth.on_schema_subscription
The text was updated successfully, but these errors were encountered: