Skip to content
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

Allow to specify which fields are exposes #2

Open
patrick91 opened this issue Mar 25, 2022 · 5 comments
Open

Allow to specify which fields are exposes #2

patrick91 opened this issue Mar 25, 2022 · 5 comments

Comments

@patrick91
Copy link
Owner

Currently we expose id, title and all the user created fields

@fabienheureux
Copy link

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

@patrick91
Copy link
Owner Author

what does it do exactly? 😊

@fabienheureux
Copy link

🤦 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

@patrick91
Copy link
Owner Author

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?

@fabienheureux
Copy link

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 👍

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

No branches or pull requests

2 participants