How should inheritance work with types? #1080
Unanswered
BryceBeagle
asked this question in
General
Replies: 1 comment
-
I rely on inheritance, particularly for input types. Which can't use interfaces anyway, so that's a good use case. I also rely on overriding fields to restrict types. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There are three different ways that inheritance can be involved in the creation of Strawberry types:
Should all be accepted? My inclination is yes, which is the current but-not-specified behavior. Using
@strawberry.interface
and@strawberry.type
ensure that the types get added to the GraphQL schema, but using a bare class means it will only exist in Python.Secondly, what should the behavior for each be? What should happen if a subclass overrides a field on the parent class. Examples of overriding I can think of:
Optional[int]
); subclass uses a more narrow type (e.g.int
)Beta Was this translation helpful? Give feedback.
All reactions