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: add support for custom attribute types #25

Closed ffMathy closed 11 months ago

ffMathy commented 11 months ago

A fork of #23, so that should probably be merged first. Please don't look at this before that has been merged, as that gives a bad impression diff-wise.

This feature adds strong-typing of attributes, their labels and names, but also allows runtime introspection of such attributes. This can be helpful for adding validation (making sure a particular field is actually a valid custom attribute name) etc. The opportunities are huge for this.

The actual runtime information is behind an emitted function (getAttributeConfigurations) on purpose. This is because it is then tree-shakeable, so it doesn't become part of the compiled bundle of most web apps today, if not used. If you do not like this, I can make a version that only has the types. However, we have several use-cases where we'd love to have the information readily available at runtime as well.

CC @gismya.

Changes

Test

ffMathy commented 11 months ago

@gismya if you want a clean diff of this before the other one is merged, I made a draft PR here: https://github.com/ffMathy/ftrack-ts-schema-generator/pull/1/files

ffMathy commented 11 months ago

I forgot to mention that this fixes #16.

ffMathy commented 11 months ago

Conflicts resolved!