Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

add support for many-to-many relationships in json2graphql #4

Open
wawhal opened this issue Sep 17, 2018 · 7 comments
Open

add support for many-to-many relationships in json2graphql #4

wawhal opened this issue Sep 17, 2018 · 7 comments
Assignees

Comments

@wawhal
Copy link
Contributor

wawhal commented Sep 17, 2018

Moved from hasura/json2graphql.
Originally opened by: @FrediBach

@FrediBach
Copy link

Copying of my last post from json2graphql:

I think the best solution would be:

users: [
    { id: 1, username: 'user1', user_ids: [2, 3] },
    { id: 2, username: 'user2', user_ids: [1] },
    { id: 3, username: 'user3', user_ids: [] },
    { id: 4, username: 'user4', user_ids: [1, 2, 3] },
]

We already have the _id naming convention for single relationships, so using _ids would be the logical solution for multiple.

And we could always combine this with the named key naming convention:

users: [
    { id: 1, username: 'user1', friends__user_ids: [2, 3] },
    { id: 2, username: 'user2', friends__user_ids: [1] },
    { id: 3, username: 'user3', friends__user_ids: [] },
    { id: 4, username: 'user4', friends__user_ids: [1, 2, 3] },
]

I've updated Blowson to correctly handle arrays like in the example above: https://github.com/FrediBach/Blowson

@FrediBach
Copy link

I've added support for custom key names in Blowson version 0.9 :-)

@chunsli
Copy link

chunsli commented Nov 26, 2018

any chance there will be support for many-to-many relationships soon, its a pretty common use case these days

@ivawzh
Copy link

ivawzh commented Dec 24, 2018

When you implement the many2many feature, would you please also keep in mind to support (even in further future) junction table filters?

Say I have tables a, b and c.
b is the junction table link between a and c.
b itself has status is_active: boolean.
I need to get the distinct set of c associated with a through active-only b.

I guess to support that filter will have some impact on the query argument interface.

Thanks in advance

@wawhal
Copy link
Contributor Author

wawhal commented Dec 25, 2018

@chunsli @ivawzh no work is being done on this issue currently and we are not sure when we will get to it. Just informing if in case it is blocking one of you folks?

We're open to contributions. It'll be really appreciated if somebody can work on this <3

@rv404674
Copy link

rv404674 commented Oct 3, 2019

@wawhal Hi wawhal. This seems interesting and the only issue that seems not be taken. I am a complete newbie and have never used Hasura. Is it a good issue for me. I am willing to learn hasura and can also dive in the codebase. If yes, can you assign it to me?

Thanks.

@marionschleifer
Copy link

@rv404674 we don't assign issues for Hacktoberfest. Here are the guidelines you can follow for contributions: https://github.com/hasura/graphql-engine/wiki/Hacktoberfest-2019-%F0%9F%8E%89. If there is a draft PR linked to the issue, it means someone is working on it 🙂

@wawhal wawhal transferred this issue from hasura/graphql-engine Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants