ftrackhq / ftrack-ts-schema-generator

Gets the schema from an ftrack instance and generates typescript interfaces for all the entity types in the instance.
Apache License 2.0
2 stars 1 forks source link

Difference between Context and TypedContext? #47

Open ffMathy opened 1 month ago

ffMathy commented 1 month ago

I have lots of plans to contribute further to this project. I think to do that, I need to understand some fundamentals.

What is the difference between TypedContext and Context?

And should children of a TypedContext also be TypedContext[] instead of Context[]?

gismya commented 1 month ago

I'm trying to get some answers internally about this about the people working closer to the data structures. What I do know: Project and TypedContext both inherit from Context. I'm not sure if children of TypedContext have a reason to be Context[], but I can't think of any examples where it's anything other than TypedContext[].

ffMathy commented 1 month ago

Alright. Can we figure it out? Where do we go from here?

gismya commented 1 month ago

I can't find any reason children of a TypedContext couldn't be typed as TypedContext[]. The reason for being Context[] in the schema was probably to allow for new types of Context to be added in the future, but that didn't happen.

(Except Project, but they can't be children of TypedContext)

Making changes to the actual schema is hard because we don't want to break code relying on the schema, but for this, we could hard code that change when creating the TS schema.