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

feat: remove optionality of types #34

Closed ffMathy closed 8 months ago

ffMathy commented 8 months ago

Properties should not be optional here in my opinion. They should instead be optional by wrapping them in a Partial<T> inside the API client when querying.

At least for properties like "id" etc that are always there. I assume an entity can't exist inside Ftrack without an ID? Others are possibly required too.

Is there a more intelligent way of seeing which are required, or can you perhaps list all the required properties for me? Then I'll make the PR better.

Changes

Test

jimmycallin commented 8 months ago

hi!

I think we need the optionality on everything except __entity_type__ and primary keys.

Primary key is 99% id, but we have some types where it's a combination of multiple properties. If you check the primary_key property in the schema, you'll find which ones are always included.

image image image image
ffMathy commented 8 months ago

Thanks for the clarification. What about things like name? Is it possible to create a task without a name etc?

jimmycallin commented 8 months ago

Thanks for the clarification. What about things like name? Is it possible to create a task without a name etc?

you will find the required fields in the required property in the schema

ffMathy commented 8 months ago

Thank you. There's now a new PR that supersedes this one: #35.