strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓
https://strawberry.rocks
MIT License
3.98k stars 531 forks source link

`Info` type is annoying to access #2768

Open patrick91 opened 1 year ago

patrick91 commented 1 year ago

having to import Info like this:

from strawberry.types.info import Info

feels a bit annoying

I wonder if we can (and should) allow this:

strawberry.Info[...]

Upvote & Fund

Fund with Polar

skilkis commented 1 year ago

I think that would be very nice!

ThirVondukr commented 1 year ago

In my experience you usually have to override it to bind it with your specific context class But having Info accessible in strawberry module would be nice

@dataclasses.dataclass
class Context:
    ...

Info = StrawberryInfo[Context, None]
from something.something import Info
patrick91 commented 1 year ago

@ThirVondukr yes, that's true, we should maybe put a guide for it 😊