-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Could not resolve alias when running griffe + this on Strawberry's codebase #7
Comments
Thanks for the link to the repo, I'll try it 🙂 Is there a branch I should check out? |
@pawamoy main :D not using typing.Doc there yet though |
Oh OK, so just adding the extension without actually adding |
correct! |
Alright, thanks! Will investigate 🙂 |
OK, that's a bit dumb: I think it's an ordering issue.The typing doc extension finds an I guess the whole extension should run as a post-process, rather than during data loading. |
I'm trying it myself right now, and found another bug 😅 if func.parent and func.parent.is_class and func.parameters and func.parameters[0].name in {"self", "cls"}: (in the extension's With this |
Actually I just pushed v0.2.3, fixing the index error, but not the alias resolution error yet. |
I think that's what I did, but let me try again with 0.2.3, I'm fine with the workaround for now! |
mmh, that doesn't seem to work, there's two similarly named files at play btw:
|
Here's my diff: diff --git a/strawberry/schema/execute.py b/strawberry/schema/execute.py
index 7a355604..21121c95 100644
--- a/strawberry/schema/execute.py
+++ b/strawberry/schema/execute.py
@@ -27,7 +27,7 @@ from strawberry.types import ExecutionResult
from .exceptions import InvalidOperationTypeError
if TYPE_CHECKING:
- from typing_extensions import Unpack
+ from typing_extensions import Unpack, NotRequired, TypedDict
from graphql import ExecutionContext as GraphQLExecutionContext
from graphql import ExecutionResult as GraphQLExecutionResult
@@ -37,10 +37,13 @@ if TYPE_CHECKING:
from strawberry.extensions import SchemaExtension
from strawberry.types import ExecutionContext
- from strawberry.types.execution import ParseOptions
from strawberry.types.graphql import OperationType
+class ParseOptions(TypedDict):
+ max_tokens: NotRequired[int]
+
+
def parse_document(query: str, **kwargs: Unpack[ParseOptions]) -> DocumentNode:
return parse(query, **kwargs) |
thanks! even it is a bit of duplication it works for me <3 |
Running griffe by itself works well, but as soon as I add griffe_typingdoc it breaks, see the full traceback:
I didn't spend too much time trying to figure the issue, I only tried to move ParseOptions around, but didn't fix the issue :)
I'm running griffe against here: https://github.com/strawberry-graphql/strawberry/
The text was updated successfully, but these errors were encountered: