Skip to main content

TestProgramDefinition

The program as the Test Program page saves it: blocks joined by edges, run from startBlockId.

  • Block ids, case ids and edge ids share one namespace: each must be unique in the program. else is reserved for the Anything Else exit and cannot be a case id.
  • Every key the request sends is kept, including ones not listed here. The page uses a block's position ({ "x", "y" }) to place it on the canvas; a block without position is laid out automatically when the program opens on the page.
  • An empty program (blocks: [], edges: [], startBlockId: null) is valid and adds no tests.
schemaVersionintegerrequired

Possible values: [1]

startBlockIdstringnullablerequired

The block the program starts from: the one Condition block with no wire coming in. null only when blocks is empty.

Example: c_category
blocks object[]required

The program's blocks. Their order does not change how the program runs.

  • Array [
  • oneOf

    A Condition block with two exits. When its one case matches, the run takes Yes (the wires whose port is the case id); otherwise it takes No (the wires whose port is else).

    It has exactly one case and hasElse: true; anything else is refused (graph.schema, reason: invalid_yesno). A case with no condition rows always takes Yes.

    idstringrequired

    Possible values: non-empty

    Example: c_eu
    typestringrequired

    Possible values: [yesno]

    titlestring

    The block's name on the page and in messages. Two blocks may not have the same name, ignoring case and spaces at the ends. Left out, messages name the block by its id.

    Example: Sold in the EU?
    descriptionstring
    hasElsebooleanrequired

    Always true, for the No exit.

    Possible values: [true]

    cases object[]required

    Possible values: >= 1, <= 1

  • Array [
  • idstringrequired

    The Yes exit. Edges leave the block from Yes with port = this id.

    Possible values: non-empty

    Example: c_eu_yes
    condition object

    Two levels: the rows of a group are joined by the group's combinator, and the groups are joined by this combinator. For example (A and B) or C is combinator: or with the groups [A, B] (and) and [C]. A group cannot hold another group (graph.schema, reason: nested_group).

    Every case needs at least one row. A case whose condition has none (left out, no groups, or empty groups) is refused with 400 (yesno.no_condition on a Yes / No block, branch.case_no_condition on a Branch).

    combinatorstring

    Possible values: [and, or]

    Default value: and
    groups object[]
  • Array [
  • idstring

    Optional; kept as sent.

    combinatorstring

    Possible values: [and, or]

    Default value: and
    conditions object[]
  • Array [
  • idstring

    Optional. A problem found in this row names it as rowId.

    Example: r1
    field objectrequired

    Which field the row reads. A system field is named by key alone; an additional field also needs entityType. A field that is not in the organization's field list is saved with the warning condition.unknown_field, and its row then matches only isEmpty.

    keystringrequired

    The field's key (see Fields on Update Test Program).

    Example: product_category
    fieldTypestringrequired

    Possible values: [system, additional_field]

    entityTypestring

    Additional fields only: lab_test (Lab Test Additional Data), itm (Item), pdt (Style), mat (Material) or po (Purchase Order).

    Possible values: [lab_test, itm, pdt, mat, po]

    labelstring

    Optional in the request; the backend writes the field list's label on save.

    Example: Product Category
    operatorstringrequired

    Must be one the field offers (see Fields on Update Test Program); otherwise 400 (condition.parse, reason: operator_not_allowed).

    OperatorMatches when the field …Value
    is / isNotis / is not the valueone value
    isAnyOf / isNoneOfis one / none of the valuesa non-empty list
    hasAllOfhas every value (no Test Program field offers it today)a non-empty list
    gt / gte / lt / lteis greater / greater or equal / less / less or equala number, or a date YYYY-MM-DD
    isEmpty / isNotEmptyhas no value / has a valuenone: leave value out

    Possible values: [is, isNot, isAnyOf, isNoneOf, hasAllOf, gt, gte, lt, lte, isEmpty, isNotEmpty]

    value

    Left out for isEmpty / isNotEmpty, one value for is, isNot and the comparisons, a non-empty list for isAnyOf / isNoneOf. Each value is plain ("S", 10000, "2026-01-01") or an option { "id", "label" }, of which only id is compared:

    • for a number field, a JSON number (10000, not "10000");
    • for a date field, a text YYYY-MM-DD;
    • for a choice field, the option id (lab_test);
    • for a taxonomy field (product_category, brand, …), the category's Custom ID;
    • for a text field, the exact text;
    • for an Organization field, always { "id", "label" } with id = a Local Organization ID (see Organization values under Fields on Update Test Program).

    Fields on Update Test Program lists what each field holds, with a sample value.

    A value of the wrong kind for the field is refused with 400 (condition.parse, reason: value_not_allowed). A choice the field does not list is saved with the warning condition.unknown_option.

    Example: ["EU","UK"]
    extraobject

    A free object the rule engine ignores.

  • ]
  • ]
  • ]
  • position object

    Where the page draws the block. Optional; kept as sent.

    xnumber
    ynumber
  • ]
  • edges object[]required

    The wires between blocks. Each one leaves a Condition block through one exit.

  • Array [
  • idstringrequired
    Example: e1
    fromstringrequired

    The Condition block the wire leaves.

    Example: c_eu
    portstringrequired

    The case id the wire leaves from, or else.

    Example: c_eu_yes
    tostringrequired

    The block the wire goes into.

    Example: a_eu
  • ]
  • TestProgramDefinition
    {
    "schemaVersion": 1,
    "startBlockId": "c_category",
    "blocks": [
    {
    "id": "c_eu",
    "type": "yesno",
    "title": "Sold in the EU?",
    "description": "string",
    "hasElse": true,
    "cases": [
    {
    "id": "c_eu_yes",
    "condition": {
    "combinator": "and",
    "groups": [
    {
    "id": "string",
    "combinator": "and",
    "conditions": [
    {
    "id": "r1",
    "field": {
    "key": "product_category",
    "fieldType": "system",
    "entityType": "lab_test",
    "label": "Product Category"
    },
    "operator": "is",
    "value": [
    "EU",
    "UK"
    ],
    "extra": {}
    }
    ]
    }
    ]
    }
    }
    ],
    "position": {
    "x": 0,
    "y": 0
    }
    },
    {
    "id": "c_category",
    "type": "branch",
    "title": "Which product category?",
    "description": "string",
    "hasElse": false,
    "cases": [
    {
    "id": "c_category_toys",
    "label": "Toys",
    "stopHere": false,
    "condition": {
    "combinator": "and",
    "groups": [
    {
    "id": "string",
    "combinator": "and",
    "conditions": [
    {
    "id": "r1",
    "field": {
    "key": "product_category",
    "fieldType": "system",
    "entityType": "lab_test",
    "label": "Product Category"
    },
    "operator": "is",
    "value": [
    "EU",
    "UK"
    ],
    "extra": {}
    }
    ]
    }
    ]
    }
    }
    ],
    "position": {
    "x": 0,
    "y": 0
    }
    },
    {
    "id": "a_eu",
    "type": "action",
    "title": "EU baseline",
    "description": "string",
    "actions": [
    {
    "name": "add_tests_by_ids",
    "arguments": {
    "packages": [
    {
    "id": "CHM-EU-01",
    "name": "string",
    "properties": [
    {
    "id": "CHM-PB-01",
    "name": "string",
    "conditions": [
    {
    "id": "L-01",
    "name": "string",
    "required": true,
    "locked": false
    }
    ]
    }
    ]
    }
    ],
    "properties": [
    {
    "id": "CHM-PB-01",
    "name": "string",
    "conditions": [
    {
    "id": "L-01",
    "name": "string",
    "required": true,
    "locked": false
    }
    ]
    }
    ]
    }
    },
    {
    "name": "add_tests_by_tags",
    "arguments": {
    "packages": {
    "operator": "anyOf",
    "values": [
    "EU",
    "children"
    ],
    "properties": {
    "operator": "anyOf",
    "values": [
    "EU",
    "children"
    ],
    "conditions": {
    "operator": "anyOf",
    "values": [
    "EU",
    "children"
    ]
    }
    }
    },
    "properties": {
    "operator": "anyOf",
    "values": [
    "EU",
    "children"
    ],
    "conditions": {
    "operator": "anyOf",
    "values": [
    "EU",
    "children"
    ]
    }
    },
    "conditions": {
    "operator": "anyOf",
    "values": [
    "EU",
    "children"
    ]
    }
    }
    }
    ],
    "position": {
    "x": 0,
    "y": 0
    }
    }
    ],
    "edges": [
    {
    "id": "e1",
    "from": "c_eu",
    "port": "c_eu_yes",
    "to": "a_eu"
    }
    ]
    }