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

@ftrack/ts-schema-generator

A TypeScript schema generator for the ftrack platform. This package generates TypeScript types based on your ftrack standard and custom entities, allowing for type-safe interactions with the ftrack API.

Environment Variables

This script requires the following environment variables to be set:

Please ensure these environment variables are set before running the script.

Usage

From source

After cloning or downloading the package, navigate to the package directory and run the following command:

yarn install

Then, to run the script using Yarn, use the yarn generate command.

As a dependency in another project

Install the package as a dependency in your project:

yarn add --dev @ftrack/ts-schema-generator

Add the following script to your project's package.json file:

"scripts": {
  "generate-ts-schema": "ftrack-ts-schema-generator"
}

Then, run the script using the following command:

yarn generate-ts-schema

Customizing the output path and filename

To customize the output path and filename, pass them as arguments:

yarn generate ./path/to/output/directory customSchemaFilename.ts

or if using the script as a dependency in another project:

"scripts": {
  "generate-ts-schema": "ftrack-ts-schema-generator ./path/to/output/directory customSchemaFilename.ts"
}

Output

The generated TypeScript file will contain interfaces for each entity type from the ftrack schema. Each interface represents the properties of that entity type, with the property names and types based on the schema.

In addition to the interfaces, the output file will also include: