Directus TypeForge

Directus TypeForge generates TypeScript definitions for Directus collections from an OpenAPI schema or a live Directus server.

December 28, 2024 2 months ago
Project categories: devtoolsopenAPItypescriptdirectusopen source
Back to projects

Directus TypeForge

Directus TypeForge generates TypeScript definitions for Directus collections from an OpenAPI schema or a live Directus server. It supports both custom and system collections, providing accurate types for use with the Directus TypeScript SDK.

This tool is a fork and rewrite of elierotenberg/directus-typescript-gen.

View project on NPM | View project on GitHub

Features

  • Dynamic Generation: Get types from a static schema file or an active Directus instance.
  • System Collections: Optionally include Directus system collections.
  • Relationships: Seamlessly represent collection relationships.
  • Configurable Output: Set custom root type names and output file paths.

Caveats

  • System Collections: System collections are present in the generated types but only contain ID fields and custom, user created fields. The IDs are included to make sure the system collections are not empty. The SDK should override the system fields with the correct types.
  • JSON Repeaters: JSON repeaters are not supported yet. There is no data describing the structure of the repeater in the OpenAPI schema and are tyepd as unknown