Ziggy - Services and Product Help

Structures, mapping and validation

Structures are used for two primary purposes.

  • Validating edge data

  • Mapping from one Structure to another

  • Take a subset of fields from a Structure

If you don't specify a Structure on an edge, data will be assigned to the edge and be passed to the next Block.

Defining a Structure

Structures are managed in the Structures main navbar button. This shows you all available Structures.

There are two ways to add a Structure.

  • In the Structures page, press the + Structure button.

  • Click on an edge bubble that has data and create a Structure from that data.

Structures Manager

Click on Structures in the nav bar.

Listing

If you have a lot of Structures, assigning tags can help filter the ones you are working with. You can see that the GOT tag is applied here.

Adding and editing Structures

  • Click on the +Structure button to add a new Structure.

  • Click a row to edit an existing Structure.

Edit

Tags

Optional, but when you have lots of structures, adding tags will help you narrow them down in the main listing.

Object and Zod

This is the main part. It might look a little intimidating at first, but it is a very powerful way to validate data.

  • You don't have to use structures in every case, so only set them up when they help.

  • It's simple to work with yet extremely powerful.

  • We have some AI supported methods of automatically generating the object based on actual edge data. This is discussed below.

Zod - full documentation here - is very widely used. You can set up simple validations, but you can also configure it do to incredibly detailed validations should you need it to.

Validating Edge Data

You can validate your Edge data using a structure or by specifying a literal validation object.

Using Structures

Structures can be used to validate an edge.

If an edge already has a Structure applied to it, a green bubble will be shown in the middle of the Edge.

Edge with Structure

If you click on the Edge bubble, you will see the following dialog. Click on the second tab to select a Structure to use for the validation.

Incoming structure

The large dropdown shows the currently selected structure. If nothing is selected, you can choose one.

If the edge data is an array, check the Expect array box.

The validation object is show at the bottom.

Using a literal validation object

If you don't want to create a Structure, but you do want to perform a validation, you can define a literal validation object in the editor field.

Literal

If the Flow has been run and the input edge has data on it, you can press the AI Generate button to generate a validation object for you.

Below is a Flow where the validation failed.

Failed validation

AI generation of Structure and validation object.

You will see two buttons in the top row.

  • Create Structure from data

  • Update Structure from data

These will create or update a Structure based on the data on the edge. For this to work, you will need to have run the Flow so the edge is populated.

You can then further edit the Structure object if you choose.

We will be enhancing the AI features significantly.

Validation and tests

Validation is very useful when used in a Test. A failed validation will cause a Test to fail.

Mapping

If the green edge bubble also has a flag icon (see above) then this indicates that there is a data mapping in place.

This maps the incoming data from the first Structure we discussed above, to another structure.

Having clicked in the green edge bubble to open the dialog, click the third tab to see the mapping configuration.

Mapping

You can manually add and remove individual field mappings.

When this mapping doesn't cut it

There will be situations where this simple mapping doesn't do enough. In this case, you should use a Javascript Block to code the mapping as you require.

Field Subsets

Let's say you have the following Structure.

{ url: z.string().url().optional(), name: z.string().optional(), gender: z.string().optional(), culture: z.string().optional(), born: z.string().optional(), died: z.string().optional(), father: z.string().optional(), mother: z.string().optional(), spouse: z.string().optional(), }

... and you want to output a subset of the object keys.

  • You should create a new "My Subset" Structure and paste in the object.

  • Remove the keys you don't need.

  • Use the napping feature described above to map across. The Guess mapping button will handle this for you,

Last modified: 10 February 2025