Advanced Guides

Helpers

AutoIncrement and UUID helpers for convenient identifiers

Overview

Use helpers with @FactoryType to generate common identifiers.

Helper table

HelperProducesExample
AutoIncrementSequential integers starting at 1 (per builder)1, 2, 3…
UUIDRFC‑4122 v4 UUID stringsd7f3e429‑9d5b‑42f9‑b7de‑8ba0e50bc9f6

Example

class Task {
  @FactoryType(() => AutoIncrement)
  id: number;
 
  @FactoryType(() => UUID)
  taskId: string;
}
 
const task = factory.one(Task).make();

Limitations

AutoIncrement is not supported for arrays. Generating an array of auto-incremented values will throw by design.

On this page