-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix: Adjust type inheritance #3
Comments
Looking at something like:
|
Another way to handle it:
|
Yeah I'd definitely prefer this. It allows for type discrimination. Also, is there a way to make |
I don't think the optionality affects type discrimination, but I can make some quick tests on that. How would the first one break type discrimination? The upside to that approach is the possibility to explicitly add what type of resource will be returned since that's sometimes known. |
I think the reason it could break it, is because I am also thinking about it in the context of this: #11 |
At first glance, this is the way I'd prefer. Does it have any downsides? |
Not that I know of. |
Alright. Maybe I'll pick this up next time I get bored. Is it only for Resources, or does it need to be fixed for other types too? |
It's for anything that inherits. Another one is I think there are instances of |
There could also be multiple levels of inheritance, for example |
Ah. If I am to contribute to this, where can I find this hierarchy? |
In the schemas. That's what we're using to build the For example
|
The ftrack API is built with an inheritance structure such that a returned type is the specified type or any of the types inheriting from that type.
For example, a
Resource
can be aResource
, aGroup
, aBaseUser
, or aUser
. Currently, the generated types only accept that it returns aResource
and gives errors if you try to check for any properties from the other types. We need to decide what strategy to implement to remedy this.The text was updated successfully, but these errors were encountered: