SpecFormula AI
ISABackendCustom Instructions

Config

Complete reference for export_vars, datatable_parameters, and allow_dynamic_parameters

Custom instructions extend the base three-field structure with three OPTIONAL fields, giving the Linter a complete input/output contract.

Instruction Object (Complete Fields)

FieldTypeRequiredDescription
namestringREQUIREDUnique instruction identifier. Used in error messages; must not duplicate within the same isa.yml.
formatstring (regex)REQUIREDRegex to match a Gherkin Step. Uses (?P<name>...) named groups to capture step parameters.
instruction_typeenumREQUIREDFor this section, the applicable value is custom.
export_varsmap<string, ExportVar>OPTIONALVariable contract exported after execution. Map key is the variable name pattern (may contain {{param}} interpolation).
datatable_parametersmap<string, DatatableParam>OPTIONALDataTable field schema.
allow_dynamic_parametersbooleanOPTIONALDefaults to false. When true, the Linter accepts any header.

allow_dynamic_parameters

ValueBehavior
false (default)Undeclared headers in the DataTable trigger an error
trueThe Linter accepts any header without error

Use case: When the Step Definition accepts arbitrary key-value pairs (e.g., product extension fields), setting this to true avoids updating the schema every time a new field is added.

- name: Product setup
  format: ^"(?P<alias>[^"]+)" is a product "(?P<productCode>[^"]+)", with table:$
  instruction_type: custom
  allow_dynamic_parameters: true    # ← accept any DataTable fields

  datatable_parameters:
    name:
      type: String
      required: true
      description: "Product name (required)"

In this example, name is required while any other fields are accepted.

Corresponding Gherkin usage:

Given "Widget" is a product "WIDGET_01", with table:
  | name   | color | weight |
  | Widget | red   | 150    |

# Linter validation:
#   ✓ name is a declared required field
#   ✓ color, weight are undeclared, but allow_dynamic_parameters: true → no error

export_vars (Output Layer)

Declares which $var this instruction exports after execution, available for subsequent steps to reference.

ExportVar Object

FieldTypeRequiredDescription
typestringREQUIREDVariable type. Allowed values: String, Boolean, Number.
descriptionstringREQUIREDSemantic description of the variable, shown in IDE hover and generated docs.
examplescalarOPTIONALExample value (number / string / boolean).
nullablebooleanOPTIONAL (default false)When true, null/empty values are allowed; when false, null triggers an error.

{{param}} Interpolation

The Map key of export_vars can use {{param}} syntax to reference named capture groups from the format regex. This allows exported variable names to be dynamically generated based on step parameters.

- name: Admin setup
  format: ^"(?P<alias>[^"]+)" is an admin, with table:$
  instruction_type: custom

  export_vars:
    "{{alias}}.id":             # ← alias comes from (?P<alias>...) in format
      type: Number
      description: "Admin ID"
      example: 1
      nullable: false
    "{{alias}}.account":
      type: String
      description: "Admin login account"
      example: "sam"
      nullable: false

Corresponding Gherkin usage:

Given "SAM" is an admin, with table:
  | role        |
  | SUPER_ADMIN |

# alias captures "SAM", Linter knows this step exports:
#   $SAM.id      → Number
#   $SAM.account → String

When (UID="$SAM.id") perform action, call table:
  | account        |
  | $SAM.account   |

# Linter validation:
#   ✓ $SAM.id exists and type is Number
#   ✓ $SAM.account exists and type is String

Types

TypeDescription
StringString value
NumberInteger or decimal number
Booleantrue / false

datatable_parameters (Input Layer)

Declares which fields the instruction's DataTable accepts, enabling the Linter to validate header spelling, types, and required fields at lint-time.

DatatableParam Object

FieldTypeRequiredDescription
typestringREQUIREDField type. Allowed values: String, Number, Boolean, Time.
descriptionstringREQUIREDSemantic description of the field, shown in IDE hover and generated docs.
requiredbooleanOPTIONAL (default false)When true, a missing field in the DataTable triggers an error.
enumsarray<scalar>OPTIONALEnumeration constraint; values not in the list trigger an error.

Types

TypeAccepted Values
StringAny string
NumberIntegers and decimal numbers
Booleantrue / false
Time@time, @date, @localTime time expressions

Example

- name: Admin setup
  format: ^"(?P<alias>[^"]+)" is an admin, with table:$
  instruction_type: custom

  datatable_parameters:
    role:
      type: String
      required: true
      description: "Admin role"
      enums: ["SUPER_ADMIN", "EDITOR", "VIEWER"]
    department:
      type: String
      required: false
      description: "Department"

Corresponding Gherkin usage:

Given "SAM" is an admin, with table:
  | role        | department |
  | SUPER_ADMIN | Operations |

# Linter validation:
#   ✓ role is required and "SUPER_ADMIN" is in enums
#   ✓ department is a declared optional field
#   ✗ If written as "deparment" (missing a t) → error: undeclared field
#   ✗ If role value is "ADMIN" → error: not in enums
#   ✗ If role is omitted → error: required field missing

Complete Example

- name: Admin setup
  format: ^"(?P<alias>[^"]+)" is an admin, with table:$
  instruction_type: custom

  export_vars:
    "{{alias}}.id":
      type: Number
      description: "Admin ID"
      example: 1
      nullable: false
    "{{alias}}.account":
      type: String
      description: "Admin login account"
      example: "sam"
      nullable: false

  datatable_parameters:
    role:
      type: String
      required: true
      description: "Admin role"
      enums: ["SUPER_ADMIN", "EDITOR", "VIEWER"]
    department:
      type: String
      required: false
      description: "Department"

On this page