Array

The Array field type allows you to generate an array of a particular field. The array can be of varying length, but being an array, all values will be of the same type.

Schema

fields:
  - name: A
    type: Array
    args:
      min: 0
      max: 10
      field:
        name: B
        type: IntegerInRange
        args:
          min: 0
          max: 10
  - name: field_a
    type: IntegerInRange
    null_probability: 0.5
  - name: array
    type: Array
    args:
      min: 1
      max: 4
      field:
        name: num
        type: Digit
        constraints:
          - type: IfNull
            name: field_a

Output

[
  { "A": [4, 9, 5, 2], "field_a": 5185946464695284972, "array": [null] },
  {
    "A": [5, 0, 2, 7, 0, 4, 3],
    "field_a": 7503849539415973306,
    "array": [null, null, null],
  },
  { "A": [1, 9, 0], "field_a": null, "array": [5, 6] },
]

Arguments

NameTypeDescriptionDefault
minintThe minimum length of the array.0
maxintThe maximum length of the array.10
fieldFieldThe field to generate the array of.

Field arguments

NameTypeDescriptionDefault Value
null_probabilityfloatThe probability that the field will be null.0.0
constraintslistA list of constraints to apply to the field.[]

Supported constraints

NameDescription
IfNullThe value must only be non-null if another field is null.