Skip to main content

Overview

Type generation automatically creates strongly typed programming language interfaces from your SuprSend JSON schemas. Instead of manually writing type definitions, you define your workflow payload structure once as a JSON schema in SuprSend, and the CLI generates type-safe interfaces for TypeScript, Python, Go, Java, Kotlin, Swift, or Dart. This ensures payloads sent to workflows always match the expected schema, catching errors at compile time instead of at runtime.
Generated type files are auto-generated and should not be manually edited. Regenerate types when you update schemas in SuprSend.

Why Use Type Generation?

Without type generation, you work with plain objects that can lead to runtime errors. Type generation catches these errors during development with compile-time type safety and IDE autocomplete.
You get early error detection, IDE autocomplete, immediate feedback when schemas change, and self-documenting code.

Generate Types

Prerequisites

Before generating types, ensure you have:
  1. SuprSend CLI installed
  2. Authenticated with your workspace
  3. ✅ Created and enabled schemas for your workflows (see guide)

Command Syntax

Once you’ve completed all the prerequisites, you can generate types using the following command in CLI. It will create type definitions for all the live schemas in your workspace:
Here’s an example of how to generate types in all languages:

Supported Languages

For complete details on command arguments and flags, see the CLI Generate Types Reference.

Output File Structure

The output of the syntax generates a file with interfaces or definitions corresponding to all events and workflows that are linked to the schemas. So, there can’t be a mismatch between the schema mapped to the event or workflow while writing the code. All events are suffixed with Event keyword and workflows are suffixed with Workflow keyword.

Use Generated Types

Once generated, you can import the type definitions in your workflow or event triggers to ensure type safety throughout your codebase.
With Pydantic models (Python), you get runtime validation. Invalid data types will raise validation errors with clear messages.

Best Practices

  • Don’t edit generated files - treat them as build artifacts and regenerate from schema changes.
  • Regenerate on schema updates - keep types in sync with SuprSend schemas (ideally in the same PR as schema changes).
  • Automate in CI/CD - run type generation in your pipeline and fail the build if generated output is out of date.
  • Version your schemas - evolve payloads safely without breaking existing producers/consumers.
  • Use types at boundaries - type the payload right before calling workflows.trigger(...) (and validate incoming webhook/event payloads).

Frequently Asked Questions

If generated types don’t match your current schemas, regenerate them using the CLI:
Always regenerate types after updating or committing schemas in SuprSend.
This usually happens when:
  • The schema is still in draft and not committed
  • Types were not regenerated after schema changes
Ensure the schema is committed and regenerate the types using the CLI.
This typically means:
  • Generated types are outdated
  • The schema was changed in SuprSend but types weren’t regenerated
  • You’re generating types from the wrong workspace
Regenerate types and verify the --workspace flag if used.
Without type safety:
  • Errors surface only at runtime
  • Invalid payloads may partially process
  • Workflow conditions and templates can break silently
  • Debugging becomes harder across environments
No. Generated files should not be edited manually. Any changes will be overwritten the next time types are regenerated. Always update schemas in SuprSend and regenerate types.
You should regenerate types whenever:
  • A schema is added or updated
  • A field is added, removed, or renamed
  • A field’s datatype changes
Many teams automate this in CI/CD.
Yes. It’s recommended to add type generation to your CI/CD pipeline to ensure schemas and application code stay in sync across environments.
Type safety ensures that the data you send when triggering workflows or events strictly matches the schema defined in SuprSend. This helps catch missing fields, wrong data types, or invalid payloads during development instead of at runtime.
Type-safe triggers help prevent production bugs caused by incorrect payloads, improve developer experience with autocomplete and validation, and ensure your workflow logic always receives valid and expected data.
SuprSend generates strongly typed interfaces directly from your JSON schemas. You define the schema once in SuprSend, and the CLI generates language-specific types (TypeScript, Python, Go, Java, Kotlin, Swift, Dart) that stay in sync with your workflows.
SuprSend supports type generation for:
  • TypeScript
  • Python
  • Go
  • Java
  • Kotlin
  • Swift
  • Dart