engine: multiselect field type (multi-value curated options) #128
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle#128
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of #77 (News v2 categories). First slice of the stack: the engine-level multi-value field type that the news categories field will use. No news-bundle changes here.
Decision record from triage on #77: full Hugo-taxonomy scope, categories only, vocabulary curated in sidecar options (not free-form), work split into stacked issues.
Agent brief follows in the comments.
Agent Brief
Category: enhancement
Summary: Add a
multiselectfield type — multiple values chosen from a curatedoptionslist — usable in page-type fields.Current behavior:
The engine has nine field types (
text,textarea,link,image,select,bool,number,datetime,page), all scalar-valued.selectis single-valued with anoptionslist declared in the sidecar. No field type can hold a list of values, and the editor has no multi-value widget. Front-matter writing already supports string lists (page-typedefaultsaccept them), but no field type produces a list value.Desired behavior:
A tenth field type,
multiselect:select:optionsis required and follows the same rules (non-empty list of unique, non-empty strings). An optionaldefaultis a list whose members must each be an option, with no duplicates.fields:only. Amultiselectparam declared on an element must be rejected at sidecar-load time with a clear error — element params serialize to shortcode params, which are single typed scalars and cannot hold lists.requiredmultiselect must be a non-empty list; an optional one may be empty. Coercion preserves the list-of-strings shape.string | booleanvalues and must be widened to carry string lists.Key interfaces:
multiselecttype constantoptionsscoping, list-valueddefaulthandling, and rejection in element contextstring | bool | number), must accept a string list for multiselectstring | booleanoptions)Acceptance criteria:
multiselectfield withoptions; sidecar load fails with clear errors on missing/empty/duplicate options, on adefaultcontaining a non-option or duplicates, and on amultiselectdeclared in an element's paramsoptions, duplicates, and wrong shapes are rejected server-siderequiredmultiselect rejects an empty list; an optional one accepts itOut of scope: