-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add many-to-many fields on polymorphic interface types #94
base: v5
Are you sure you want to change the base?
Add many-to-many fields on polymorphic interface types #94
Conversation
Most of this is just refactoring to prevent duplication and remove some inlining for clarity.
-- TODO: At the moment, relationships do not include polymorphic interfaces. | ||
-- As a result, the following annotations do not produce many-to-many relationships | ||
-- on the Person interface. | ||
COMMENT ON TYPE j.team_membership IS $$ | ||
@interface mode:union | ||
@name TeamMembership | ||
@behavior node | ||
@ref member to:Person singular | ||
@ref team to:Team singular | ||
$$; | ||
|
||
COMMENT ON TABLE j.internal_team_membership IS $$ | ||
@implements TeamMembership | ||
@ref member via:(person_id)->j.internal_employee(id) singular | ||
@ref team via:(team_id)->j.team(id) singular | ||
$$; | ||
|
||
COMMENT ON TABLE j.external_team_membership IS $$ | ||
@implements TeamMembership | ||
@ref member via:(person_id)->j.external_person(id) singular | ||
@ref team via:(team_id)->j.team(id) singular | ||
$$; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjie , something like this is how I was envisioning that this would work for union interface types. Does this approach make sense to you?
Hi Josiah, we've already discussed this privately in chat, but I'm posting it here for anyone else following this issue. I'm not happy with the way polymorphism works in Grafast, it's one of the major remaining issues that needs to be handled before we can release Grafast V1. I have a plan to address it but it's going to take a while to execute the plan, and it's currently stacked behind other Grafast work; as such I don't want to expand polymorphism in PostGraphile until new new system is complete as it'll just mean more things need rewriting. So this is on hold for a few months until the following issue is closed: |
Most of this is just refactoring to prevent duplication when extending the fields . It also removes some inlining for clarity.
This will add GQL fields (this will be additive, so should not be breaking) for any schemas that include junction tables with polymorphic tables.
The final commit includes a test for polymorphic junctions to polymorphic union interfaces. The plugin doesn't currently support adding these relationship fields on the interface, but this is something that I hope to add in the future.