Models

Models in Sanbox

Models can be thought of as schema, or classes to your data. Use cases for Models in Sanbox include...

  • Ensuring data follows a specific format.

  • Validating incoming data for API requests.

  • Using models as templates to building JSON objects with the Builder Node.

Understand Sanbox's *Typing* Methodology

Many iPaaS systems keep data restricted to predefined schema throughout their solution. Sanbox follows a dynamic system, which allows you to create things faster, but also requires you to pay closer attention to what is flowing through your Workflows. When viewing models in the Model Viewer, you will find many Nodes do not follow a Model, and simply output dynamic data.

Models serve their purpose when you need to restrict and validate the structure of your data.

Model References

A Model Reference

References are used throughout Sanbox and can be a one-off definition (custom), a predefined model (a model created in the project), or dynamic (no model).

Right-Clicking a model reference allows you to copy the reference or paste a copied reference. You can also drag-n-drop a model from the Universe Panel to use it in the reference or drag-n-drop between references on the designer surface.

Make sure you use references from the same project, or Sanbox will mark the reference as broken.

Creating a Model

You can create a Model by visiting the Universe Panel, right-clicking a folder, and choosing the New Modeloption. The Model Editor will be displayed when creating a new model.

Model Editor

When creating a new Model, you will first be asked for the root Model type, which can be changed later. The above example shows a root model type of Object with a name, age, and occupation property.

Properties

When you have an object in your model, it can be made of one or many properties. Properties have numerous settings. Right-clicking a property will open options.

Is Required

Setting a property to Is Required indicates that if the property is null or empty when validating, an error is thrown.

Description

A description is visible only in the Designer, and is a quick summary of a property.

Display Name

A property can have a display name, display names are used in the Validate Model Node to convey user friendly error messages for validation errors.

Validation

Some property types have validation that can be applied. Validation is done whenever a Model is validated.

References

Models may also reference other models in their definition.

Person Model with a reference to an Order Model

Generating a Model

Clicking the button on the top right of the Model Editor will allow you to generate a Model from JSON in a file or clipboard. Sanbox is also able to generate a Model from a database table.

‚Äč