daw_field_type/v1: define the form of collection.values entries (label with resource_id) #17

Open
opened 2026-11-15 19:39:25 +01:00 by michael · 1 comment
Owner

Problem

In daw_field_type/v1, collection.values (for source = static) is
only "an array": the element type is not defined. A receiver cannot know
how to read an entry, and an entry cannot carry a translatable label.
Without a label, an adapter can only show the raw value (for example
yes), untranslated. The same problem is already solved elsewhere:
daw_error/v1 and daw_event/v1 carry a canonical English message
and an optional resource_id (daw_i18n/v1).

First use case: a yes/no confirmation declared as selection / static /
single with two answers, shown by cli, web, desktop and api alike.

Proposal

Each entry of collection.values is either

  • a string, as today: it is the value and the display text at once
    (existing examples stay valid), or
  • an object { "value": ..., "message": ..., "resource_id": ... }:
    value is the language-neutral value returned in the answer,
    message the canonical English display text, resource_id optional
    and only valid together with message, resolved like in
    daw_error/v1; if it cannot be resolved the adapter falls back to
    message

This is a new optional form inside v1 (see "Growth within a version" in
TEMPLATE.md): objects that use strings stay valid.

Open questions

  • may strings and objects be mixed in one array (suggestion: no, all
    entries of one array use the same form)
  • placeholders in message: none in v1 (static labels carry no data)
  • where the value of an answer is placed in daw_event_response/v1, and
    where the declared field is placed in daw_event/v1 (provisionally
    data.value / data.answer, see the berhtjan-core companion issue);
    separate issue after the first validation

Acceptance criteria

  • specification.md and contract.json describe both entry forms
  • valid and invalid examples (object with and without message,
    resource_id without message, mixed array)
  • rationale.md explains why labels follow the daw_error/v1 pattern
  • CHANGELOG entry

DAW/daw-modul-berhtjan-core, DAW/daw-modul-berhtjan-cli#14,
DAW/fragjan#137, DAW/daw-contracts#2

## Problem In `daw_field_type/v1`, `collection.values` (for `source = static`) is only "an array": the element type is not defined. A receiver cannot know how to read an entry, and an entry cannot carry a translatable label. Without a label, an adapter can only show the raw value (for example `yes`), untranslated. The same problem is already solved elsewhere: `daw_error/v1` and `daw_event/v1` carry a canonical English `message` and an optional `resource_id` (`daw_i18n/v1`). First use case: a yes/no confirmation declared as `selection` / `static` / `single` with two answers, shown by cli, web, desktop and api alike. ## Proposal Each entry of `collection.values` is either - a string, as today: it is the value and the display text at once (existing examples stay valid), or - an object `{ "value": ..., "message": ..., "resource_id": ... }`: `value` is the language-neutral value returned in the answer, `message` the canonical English display text, `resource_id` optional and only valid together with `message`, resolved like in `daw_error/v1`; if it cannot be resolved the adapter falls back to `message` This is a new optional form inside `v1` (see "Growth within a version" in TEMPLATE.md): objects that use strings stay valid. ## Open questions - may strings and objects be mixed in one array (suggestion: no, all entries of one array use the same form) - placeholders in `message`: none in v1 (static labels carry no `data`) - where the value of an answer is placed in `daw_event_response/v1`, and where the declared field is placed in `daw_event/v1` (provisionally `data.value` / `data.answer`, see the berhtjan-core companion issue); separate issue after the first validation ## Acceptance criteria - [ ] specification.md and contract.json describe both entry forms - [ ] valid and invalid examples (object with and without `message`, `resource_id` without `message`, mixed array) - [ ] rationale.md explains why labels follow the `daw_error/v1` pattern - [ ] CHANGELOG entry ## Related DAW/daw-modul-berhtjan-core, DAW/daw-modul-berhtjan-cli#14, DAW/fragjan#137, DAW/daw-contracts#2
Author
Owner

Cross references

Part of one first validation (yes/no confirmation before a module is
removed), together with:

Both use the object form of collection.values provisionally, marked
as such, until this issue is decided.

## Cross references Part of one first validation (yes/no confirmation before a module is removed), together with: - DAW/daw-modul-berhtjan-core#21 (build and check the response) - DAW/daw-modul-berhtjan-cli#15 (ask the declared field) Both use the object form of `collection.values` provisionally, marked as such, until this issue is decided.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-contracts#17
No description provided.