Skip to main content

Table of Contents

Synth has the following types of generators:

Modifiers#

Modifiers encode additional constraints or variations on their contained generator(s)

  • optional makes a value nullable
  • unique ensures the generated values don't contain duplicates
  • one_of allows you to choose from a set of contained generators
  • same_as creates a reference to another field in this or another collection

Generators#

  • null generates as many nulls as you ever want
  • bool generates true or false, either constant or following a given percentage
  • number generates ranges, distributions or series of integer or floating-point numbers
  • series generates streams of events (e.g. for logs)
  • string can contain one of the following generators for various classes of string:
    • pattern takes a regular expression and generates matching strings
    • uuid generates hyphenated UUIDs optionally with time zone
    • faker has a large number of generators for names, contact information, credit card numbers, sentences, and much more
    • format combines multiple generators to one formatted string
    • serialized JSONifies the value of the contained generator
    • truncated ensures all generated strings stay within length limits
    • categorical is like a one_of specialized for strings
  • date_time generates dates and times,
  • object creates an object with string keys containing generators for the values
  • array fills an array of the given length with elements of the contained generator
  • datasource pulls data from an external source like a file