concrete/contract/list-scalar
A list declares exactly one legal item, a value element, an object or a row, with satisfiable bounds.
A list declares exactly one legal item, a value element, an object or a row, with satisfiable bounds.
Graded by the contracts stage of concrete check, in the contract venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
A list's item is exactly one thing, and the grammar is what every layer reads it by:
a single value slot (item: image()), an object of fields, or a row — never a
list. An object's fields are flat, because identity is a flat four-part tuple with no
fifth element to reach through: a list of objects among them is one field, one level
deep.
A section built by a Concrete older than 9.0 spelled a record item as the list's own
fields, with a title naming one of them and a unique flag on a value list, and
those stored forms are still graded by the rules they were written under: title
belongs to a record item and names one of its fields; unique belongs to a value item,
and over a written-out vocabulary it must be satisfiable — a max above the distinct
option count is an add button that never enables, and a min above it is a list that
can never be filled at all. A record of one field is legal, as an object of one field
is anywhere: an object is a card, whatever it holds. Beside
an object or a row item, a stored title or unique is refused: the item's title
is its object's label, and distinctness is a pick's own.
A select item is the one vocabulary a fill can read, so it must be written out as its
from: a fact-derived vocabulary resolves in the editor, which the fill never
reaches, and the list would fill silently empty.
Type-caught for today's builders, which take no fields, title or unique on a
list and no list as an item. Check-caught for a stored section, for the select
vocabulary and for the bounds.
Fix
Rebuild the section with the current Concrete. A record item becomes an item function
returning an object — a single field is legal there — its title the object's
label, and a list's distinctness the fill.pick that fills it. Both forms are
list.
Before and after
// A list declared its record item as `fields` before 9.0; this half is that stored shape, and today's builders refuse it.
// @noErrors
import { fact, list, text } from "@homepages/concrete";
list({
label: "Team",
source: fact.property.contacts,
fields: (contact) => ({
name: text.short({ source: contact.name, label: "Name" }),
}),
});import { fact, list, object, row, text } from "@homepages/concrete";
list({
label: "Team",
source: fact.property.contacts,
item: (el) => {
const contact = row({ label: "Contact", from: fact.property.contacts, source: el });
return object({
fields: {
contact,
name: text.short({ label: "Name", source: contact.name }),
},
});
},
});