Open patrick91 opened 2 years ago
What do you think of mimicking the wagtail-grapple approach with the register_query_field
function https://github.com/torchbox/wagtail-grapple/blob/9b8a49c05ddc74673e980e6a359c9f642aae8877/grapple/helpers.py#L53 ?
It could be interesting to follow a similar API, it might help make both packages to converge at some point
what does it do exactly? 😊
🤦 a link to the doc might have been better https://wagtail-grapple.readthedocs.io/en/latest/general-usage/decorators.html?highlight=register_query_field#module-grapple.helpers
It is a decorator that you can use to add a specific field to the schema
ah right! I was thinking of exposing model by default, but maybe this approach is better.
I wonder if we can find a way that also can be used by other strawberry stuff, ie:
from strawberry_wagtail.query import Query
@Query.add_field("advert")
class Advert:
...
this add field could exist on strawberry too. Maybe we can experiment here with it and then propose it for Strawberry, what do you think? Or would you prefer to use the same API as grapple?
That's a good idea, I am still new to strawberry ecosystem but I think it could be more interesting to create "standards" shared across this ecosystem rather than creating fragmentation.
Regarding the grapple API, I am not too opinionated about whether we should use the same, but we should at least keep it in mind when introducing new concepts because we could benefit from the existing work done there.
TLDR : I am fine with what you suggested 👍
Currently we expose id, title and all the user created fields