|
| 1 | +--- |
| 2 | +"@object-ui/types": minor |
| 3 | +"@object-ui/core": minor |
| 4 | +"@object-ui/components": minor |
| 5 | +"@object-ui/plugin-form": minor |
| 6 | +"@object-ui/app-shell": minor |
| 7 | +--- |
| 8 | + |
| 9 | +refactor(fields): `requiredWhen` is the only required-predicate slot — drop the retired `conditionalRequired` alias |
| 10 | + |
| 11 | +`@objectstack/spec` 17 (objectstack#3855) **retired** `Field.conditionalRequired`, |
| 12 | +the long-deprecated alias of `requiredWhen`. ObjectUI carried a back-compat read |
| 13 | +for it in seven places; all of them are removed. |
| 14 | + |
| 15 | +The removal is safe because the spec did not merely *stop emitting* the key — it |
| 16 | +made authoring it **fail loudly**. `retiredKey()` declares the key as |
| 17 | +`z.never()`, so: |
| 18 | + |
| 19 | +- `z.input` types it as `never` — writing it is a `tsc` error at the authoring site; |
| 20 | +- the parse **rejects** it (verified against `17.0.0-rc.0`), at both `FieldSchema` |
| 21 | + and `ObjectSchema`, with the prescription as the message: |
| 22 | + |
| 23 | + > `conditionalRequired` was removed in @objectstack/spec 17 (#3855) — use |
| 24 | + > `requiredWhen`. Rename the key; the value (a CEL predicate) is unchanged. |
| 25 | + > Run `os migrate meta --from 16` to rewrite it automatically. |
| 26 | +
|
| 27 | +So spec-parsed metadata cannot carry the key — an object declaring it fails to |
| 28 | +load rather than loading with the rule silently dropped. Keeping a renderer-side |
| 29 | +`requiredWhen ?? conditionalRequired` would have re-created exactly the second |
| 30 | +de-facto contract the tombstone exists to prevent: the key would have kept |
| 31 | +working in the UI while being rejected everywhere else, hiding the producer's bug |
| 32 | +(AGENTS.md #0.1). "Backend-agnostic" (#1) does not argue for keeping it either — |
| 33 | +`conditionalRequired` is an ObjectStack-spec-ism, so the only producers that ever |
| 34 | +emit it are ObjectStack producers on ≤16, and the spec ships them a converter. |
| 35 | + |
| 36 | +Removed from: |
| 37 | + |
| 38 | +| package | site | |
| 39 | +| :--- | :--- | |
| 40 | +| `@object-ui/types` | the `conditionalRequired?:` member on `FormField` | |
| 41 | +| `@object-ui/core` | the `??` fallback + rules-param member in `resolveFieldRuleState` | |
| 42 | +| `@object-ui/components` | three pass-throughs in the form renderer | |
| 43 | +| `@object-ui/plugin-form` | `ObjectForm`, `ModalForm`, `sectionFields`, `deriveMasterDetail` (×2) | |
| 44 | +| `@object-ui/app-shell` | the field inspector's legacy read/auto-migrate, and the key's entry in `clientValidation`'s CEL lint list | |
| 45 | + |
| 46 | +**Studio authors lose nothing.** The object designer's draft validation parses |
| 47 | +against the spec's own `ObjectSchema`, so a draft carrying the key now surfaces |
| 48 | +the tombstone's rename prescription under the same `fields.<name>.conditionalRequired` |
| 49 | +path the CEL lint used to report — a better message than the inspector's silent |
| 50 | +auto-migration, and one the server agrees with. That behavior is pinned by a test. |
| 51 | + |
| 52 | +**Migrating:** rename the key to `requiredWhen` (the CEL value is unchanged), or |
| 53 | +run `os migrate meta --from 16`. |
0 commit comments