Skip to content

Commit 182ed4c

Browse files
committed
fix(spec): narrow the options describe and the form refusal remedy to members that cannot be spelled
An enum-typed metadata-form row may carry an inline options list, for human labels or a deliberate subset. Only a row whose members cannot be spelled as option values omits options and derives them from the served JSON Schema, with meanings in helpText. The describe on FormFieldSchema.options and the remedy sentence defineForm appends to an option-value grammar refusal now state exactly that. What is refused and accepted is unchanged. Tests: each case carries a firing and a dark control on real spec enums (object.managedBy refused with options and green without; a labelled object.sharingModel list and the field.deleteBehavior subset green, and refused with one member mis-spelled). The old blanket-rule pins are reversed into assertions of the narrowed wording. Claude-Session: https://claude.ai/code/session_013RDBh5DqXd2xnLwvHLgLFr Co-authored-by: Claude <noreply@anthropic.com>
1 parent 61ff3ae commit 182ed4c

3 files changed

Lines changed: 263 additions & 79 deletions

File tree

‎.changeset/19678-form-option-enum-derive-remedy.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"@objectstack/spec": patch
33
---
44

5-
A metadata form's option-value refusal now says what to do: `defineForm`'s module-load refusal of an inline option `value` that fails the system-identifier grammar names the derive path, and the form field's `options` describe states the same rule (#19678).
5+
A metadata form's option-value refusal now says what to do: `defineForm`'s module-load refusal of an inline option `value` that fails the system-identifier grammar names the derive path, and the form field's `options` describe states the rule it belongs to (#19678, #19907).
66

77
Clause-②: no
88

9-
A form option `value` is a lowercase system identifier — `FormSelectOptionSchema` reuses `SelectOptionSchema.value` by reference — so an enum member carrying a hyphen or a capital (`object.managedBy`'s `system-data`, `action.openIn`'s `new-tab`, `action.execution`'s `perRecord`) cannot be written as an inline option at all. That bound stays. For a metadata-form row whose key is a spec enum, the answer is to omit `options`: the control derives the members from the served JSON Schema, and their meanings go in `helpText`.
9+
A form option `value` is a lowercase system identifier — `FormSelectOptionSchema` reuses `SelectOptionSchema.value` by reference — so an enum member carrying a hyphen or a capital (`object.managedBy`'s `system-data`, `action.openIn`'s `new-tab`, `action.execution`'s `perRecord`) cannot be written as an inline option at all. That bound stays. An enum-typed metadata-form row may still carry an inline `options` list, to give its members human labels or to offer a deliberate subset. A row whose members cannot be spelled as option values omits `options`: the control derives the members from the served JSON Schema, and their meanings go in `helpText`.
1010

11-
- **The refusal names the remedy.** `defineForm` still throws a `ZodError` at module load with the same issues and codes (`invalid_format` for the pattern, `too_small` for the two-character floor). The grammar message on an inline option's `value` is kept and now carries the derive path after it. Only schema-bound forms built by `defineForm` get this sentence. The grammar message where it is declared (`SystemIdentifierSchema`) is unchanged, because it also bounds object-field options and three object-storage names, where omitting `options` is not the answer.
12-
- **The describe states the rule** on `FormFieldSchema.options`, and that text is served in the JSON Schema and the generated reference page.
11+
- **The refusal names the remedy.** `defineForm` still throws a `ZodError` at module load with the same issues and codes (`invalid_format` for the pattern, `too_small` for the two-character floor). The grammar message on an inline option's `value` is kept, and now carries the derive path after it, for a row whose members cannot be spelled as option values. Only schema-bound forms built by `defineForm` get this sentence. The grammar message where it is declared (`SystemIdentifierSchema`) is unchanged, because it also bounds object-field options and three object-storage names, where omitting `options` is not the answer.
12+
- **The describe states the rule** on `FormFieldSchema.options`: an inline list is allowed on an enum-typed row, and the derive path is named for a row whose members cannot be spelled. That text is served in the JSON Schema and on the generated reference page.
1313
- ⛔ **No accept-set change.** Every value refused before is still refused, and every value accepted before is still accepted. No key, export or schema shape moves.

0 commit comments

Comments
 (0)