> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suprsend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Types

> Generate typed code from trigger payload JSON schemas for TypeScript, Go, Python, Java, Kotlin, or Swift using the suprsend generate-types command.

Generate typed code from trigger payload JSON schemas. Fetches schemas linked to workflows and events from a workspace and generates type definitions in the target language.

## Syntax

```bash theme={"system"}
suprsend generate-types <language> [flags]
```

**Arguments:**

| Argument | Description |
| - | - |
| `<language>` | Target language: `typescript`, `go`, `python`, `java`, `kotlin`, `swift`, `dart` |

## Common Flags

| Flag | Description | Default |
| - | - | - |
| `-h, --help` | Show help for the command | – |
| `--output-file string` | Output file path for generated types | Language-specific default |
| `--mode string` | Version mode (`draft` or `live`) | `live` |
| `--workspace string` | Workspace to get schemas from | `staging` |

## Language-Specific Flags

> [tab] TypeScript
>
> Generate TypeScript type definitions from trigger payload schemas. Fetches linked schemas and generates types in a single output file. Supports Zod schema generation with `--zod`.
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Output file path | `suprsend-types.ts` |
> | `--zod` | Generate Zod schemas instead of plain TypeScript types | `false` |

> [tab] Python
>
> Generate Python type definitions from trigger payload schemas. Fetches linked schemas from the workspace and generates a single Python file with type classes. Supports Pydantic models (enabled by default).
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Output file path | `suprsend_types.py` |
> | `--pydantic` | Generate Pydantic BaseModel classes instead of plain dataclasses | `true` |

> [tab] Go
>
> Generate Go type definitions from trigger payload schemas. Produces struct definitions in a single output file with the specified package name.
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Output file path | `suprsend_types.go` |
> | `--package string` | Go package name for generated structs | `suprsend` |

> [tab] Java
>
> Generate Java type definitions from trigger payload schemas. Creates one Java file per linked schema in a package directory structure. Supports Lombok annotations with `--lombok`.
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Accepted but not used for Java: each type is written to `<package dir>/<TypeName>.java` | `SuprsendTypes.java` |
> | `--package string` | Java package name for generated classes | `suprsend.types` |
> | `--lombok` | Add Lombok annotations to generated classes | `false` |

> [tab] Kotlin
>
> Generate Kotlin type definitions from trigger payload schemas. Produces data classes in a single output file with the specified package name.
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Output file path | `SuprsendTypes.kt` |
> | `--package string` | Kotlin package name for generated data classes | `suprsend` |

> [tab] Swift
>
> Generate Swift type definitions from trigger payload schemas. Produces Codable structs in a single output file.
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Output file path | `SuprsendTypes.swift` |

> [tab] Dart
>
> Generate Dart type definitions from trigger payload schemas. Produces null-safe classes in a single output file.
>
> | Flag | Description | Default |
> | - | - | - |
> | `--output-file string` | Output file path | `suprsend_types.dart` |

## Example

```bash typescript theme={"system"}
# Generate TypeScript types
suprsend generate-types typescript

# Generate TypeScript types with Zod schemas
suprsend generate-types typescript --zod --workspace production

# Custom output file
suprsend generate-types typescript --output-file src/types/notifications.ts
```

```bash python theme={"system"}
# Generate Python types (Pydantic by default)
suprsend generate-types python

# Generate plain dataclasses
suprsend generate-types python --pydantic=false

# Generate from production workspace
suprsend generate-types python --workspace production
```

```bash go theme={"system"}
# Generate Go types
suprsend generate-types go

# Custom package name
suprsend generate-types go --package notifications --output-file notifications/types.go
```

```bash java theme={"system"}
# Generate Java types
suprsend generate-types java

# Generate with Lombok annotations
suprsend generate-types java --lombok --package com.myapp.notifications
```

```bash kotlin theme={"system"}
# Generate Kotlin data classes
suprsend generate-types kotlin

# Custom package
suprsend generate-types kotlin --package com.myapp.notifications
```

```bash swift theme={"system"}
# Generate Swift Codable structs
suprsend generate-types swift
```

```bash dart theme={"system"}
# Generate null-safe Dart classes
suprsend generate-types dart
```


## Related topics

- [Type Safety](https://docs.suprsend.com/docs/type-generation.md)
- [CI/CD with the SuprSend CLI](https://docs.suprsend.com/reference/cli-ci-cd.md)
- [Commands and Flags](https://docs.suprsend.com/reference/cli-schema-overview.md)
- [CLI Overview](https://docs.suprsend.com/reference/cli-intro.md)
- [Product Updates](https://docs.suprsend.com/changelog/overview.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.