-
-
Notifications
You must be signed in to change notification settings - Fork 569
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
It should be possible to declare a shared @ref
only in the base table when using relational polymporphism
#2087
Comments
The documentation currently describes the
Based on #1876 and #1874, it seems like a better description might be:
|
I think what you're asking for is essentially inheritance. Interfaces in GraphQL do not perform inheritance - they just describe the interface that is expected, and it's up to the implementations to then provide fields matching the interface. Currently I'm following the GraphQL pattern. That said, for relational tables, there is effectively inheritance so I can see the value in that; feel free to work on a PR for it (for relational and single table interfaces only). This is a feature that could be added long after v5.0.0 ships since there's already a solution, so it will be at the very bottom of my TODO list to fix myself. |
Feature description
Note: I'm talking about "derived tables" as in "derived class" from OOP, not as in PostgreSQL table inheritance
I have a
Profile
type which can concretely be an instance ofIndividual
orOrganization
. Each profile can also be a member of one or more organizations (OrganizationMember
). I therefore wish to define this property on the base table (using@ref
and@refVia
):However, this does not work. Instead, I must define the property on each of my derived tables as well (Postgraphile is kind enough to throw an error if I don't so at least I won't forget):
It would be really nice if Postgraphile was able to infer the relationship based on the base table only. It would reduce code duplication and reduce the risk of bugs.
More complete SQL
Supporting development
I [tick all that apply]:
The text was updated successfully, but these errors were encountered: