team-genny / genny

0 stars 1 forks source link

Add support for nesting in schemas #9

Open fergcb opened 4 months ago

fergcb commented 4 months ago

Schemas should be able to be nested. Currently, a schema field may only evaluate to a scalar value (e.g. a string, number or boolean). This issue proposes a way to allow a schema field to describe a nested object or schema.

A schema with a nested object would look like this:

{
  "slug": "nesting-demo",
  "fields": [
    {
      "name": "id",
      "formula": "UUID"
    },
    {
      "name": "event_data",
      "fields": [
        { "name": "source_ip", formula: "IPV4" },
        { "name": "timestamp", formula: "ISO_DATE" },
      ]
    }
  ]
}

which would produce records like this:

{
  "id": "8b6fbcb1-0ac3-434e-9651-a9a4e8cfa729",
  "event_data": {
    "source_ip": "105.183.166.201",
    "timestamp": "2024-04-24T12:53:14.596Z"
  }
}