Smidyo payloadlets and their shape

Frank Sandqvist
Smidyo Codex
Published in
3 min readJun 20, 2019

Smidyo is a platform that allows small businesses to automate their quotation process — check it out! This article is also available here.

The data chunks passed around in Smidyo are known as payloadlets, and they can come in different shapes and sizes.

Whenever a pipeline or a block of some sort is invoked in Smidyo, we call the set of data it’s fed the “payload”. That payload of data is made up of one “payloadlet” per input.

A payloadlet can take on different shapes. It has three modifiers, which define its shape:

Type — What type of data does this payloadlet contain?

List — Does the payloadlet contain more than one item?

Nullable — Can the data, or one of the items in the list, be nullish (not provided, or no data)?

By defining these modifiers, we can tell in advance what kind of data we can be expecting.

Type modifier

Smidyo supports different types of data to be processed. As the data being passed around in Smidyo are simply just JSON, a Smidyo data type is defined through its JSON Schema.

Currently supported data types

number A floating point number. This is the most used data type in Smidyo, since this is what yield pipelines use to get their prices from.

text A text string.

boolean Either true or false.

file-any File of any type.

file-svg Scaleable Vector Graphics file.

The corresponding JSON schemas for these data types will soon be available. (Let us know if you need them right now!)

List modifier

Sometimes you need to pass many payloadlet items into an input, rather than a single one.

However, even if the list modifier is false, it’s still a list — but it must have a length of exactly 1. Because of this, we can always supply an input that expects a list with a singular item.

Here is an example of some singular and list payloadlets:

Singular payloadlets (list = false)
-> Compatible with both list and singular data shapes
["my great text"]
[24]
[{"svg": "249c0fbc-aea7-49bd-8a65-0fa3816d94a2.svg"}]
List payloadlets (list = true)
-> Only compatible with list shape
[5, 20, 24, 1520]
["my great text", "another text"]
[5300]
[] (empty list)

Nullable modifier

Sometimes we can get a null output when processing data. To decide whether a payloadlet is nullish or not:

Was the input or output we’re checking even included in the payload?

If not, the payloadlet is nullish, as Smidyo does not have a concept of “un-defined” values. This is usually the case with optional I/O on pipelines and blocks.

Is it singular or a list?

If it’s a singular item, and that item is equal to null, the payloadlet is nullish. Otherwise we check every item of the list, and if any one of them is null, the payloadlet is nullish.

Remember though, false != null

One may think that when using the data type boolean, that the payloadlet in the state of "false" may also be nullish. But this is not the case, since Smidyo never does any special checks on particular data types.

If we want to do “branching path” logic, we usually use boolean type payloadlets, that are nullable, so we end up with true/null logic. (not true/false)

Here are some examples:

Non-nullish payloadlets (nullable = false)
-> Compatible with both nullable or non-nullable shape
[1]
[25, 14, 592.14]
[true]
[false]
[false, true]
["my text"]
[] (empty list)
Nullish payloadlets (nullable = true)
-> Only compatible with nullable shape
[null]
["foo", "bar", null]
[144, null, 1500, 2500]
[null, null, null]
[false, null, null]

--

--