Skip to content

Scan fields

x-lt-scan makes a form field take a scan. While a claimed form is open and editable, a scan whose scheme a field accepts fills that field. A scan that no field accepts, and every badge scan, goes to the global scan pipeline as usual (see Scan codes).

Token Placement Purpose
x-lt-scan Field The schemes a field accepts and the values it expects
x-lt-scan-submit Schema root Submit once every required scan field holds a value
{
"type": "object",
"x-lt-scan-submit": true,
"required": ["containerCode"],
"properties": {
"containerCode": {
"type": "string",
"title": "Container",
"x-lt-scan": {
"schemes": [14],
"expect": ["metadata.containerCode", "envelope.offeredContainers"],
"expect-error": "This item goes in {{expected}}."
}
},
"parts": {
"type": "array",
"items": { "type": "string" },
"x-lt-scan": { "schemes": [16], "expect": ["envelope.expected_upcs"], "multiplicity": "count" }
}
}
}
Key Meaning
schemes The scan scheme versions the field accepts. Required
value "target" (default) writes the scanned target; "code" writes the code as scanned
expect Context paths (metadata.*, envelope.*, lookup.*, and so on) whose values the field accepts. A path that holds a list contributes every entry
expect-error The message for a scan outside expect; {{expected}} lists what the field accepts. Default: Expected {{expected}}
multiplicity Array fields: "count" admits a value as many times as expect lists it (a part expected twice takes two scans); otherwise each expected value is admitted once
prompt Array fields: the instruction shown while the field is empty. Default: the field’s description

A scan replaces a string field’s value. An array field appends, up to maxItems. Manufacturer barcodes compare as GTINs, so a UPC-A matches its 14-digit form.

An array scan field reads as a checklist: its prompt while empty, n of N beside the label, and a remove control on each scanned value while the form is editable. N is what expect admits (each listing under multiplicity: "count", each distinct value otherwise), or maxItems, so the count and the admission check agree. A removed value is admitted again on the next scan.

  1. The focused field, when it accepts the scan’s scheme.
  2. Otherwise the first field in x-lt-order that accepts it and has room.
  3. Otherwise the first field that accepts it.

A scan outside expect shows an error directly under the field that refused it and leaves the field as it was. An accepted scan shows a confirmation in the same place. Either way the field scrolls into view. The shared validator runs the same check at submit, so a typed value outside expect is a field error in the form and a 422 from the API.

At the schema root, true submits the form once every required scan field holds a value and the form validates. On a shared station the submit raises the usual badge prompt, so the motion is: scan the container into the open form, then scan your badge.