Migrate to 0.19
0.19 reads definition format 1.3, which adds the scale and rating field types, option image, field columns and section layout: "matrix". Upgrade the server that runs validateSubmission() before the clients.
npm i @formhaus/core@^0.19 @formhaus/react@^0.19
npm i @formhaus/core@^0.19 @formhaus/vue@^0.19Changes
| Area | Old (0.18) | New (0.19) | Action |
|---|---|---|---|
| Types | A field with type rating was a custom type: no type check, your component from components | rating is built in: the value must be a whole number from 1 to validation.max, and the built-in star field renders when components has no rating entry | Rename a custom type to a dashed name, such as x-rating, in the definition and in components |
| Types | A field with type scale was a custom type | scale is built in: the value must be a whole number from validation.min to validation.max | Rename a custom type to a dashed name, such as x-scale |
| Checks | None | A scale or rating with min or max that is not an integer, or with fewer than 2 or more than 11 points, is an invalid-scale error. rating max must be 2 to 11 | Keep the range within 2 to 11 whole-number points |
| Checks | None | An option image that does not start with https: or data:image/ is an unsafe-image-url warning | Serve option images over https |
| Format | FORMAT_VERSION was "1.2" | "1.3" | Set "formatVersion": "1.3" on definitions with scale or rating |
| Types | DefaultFieldType had 17 names | It adds scale and rating | Add scale and rating to an exhaustive Record<DefaultFieldType, …>, such as a component map |
| Checks | unknown-field-type compared a dashed type with the built-in names by spelling distance, so x-rating was reported as a typo of rating | A type with - or : is reported only when it is a built-in name with separators, such as multi-select | None |
| Install | Node 20 | Node 22.12 or later for @formhaus/core, react, vue, mcp and formhaus | Upgrade Node |
Default messages
getDefaultMessage() and the built-in validation errors use new texts for length and item limits. Tests and snapshots that compare these strings need the new texts. To keep the old ones, set them in the definition messages, such as "messages": { "minLength": "Must be at least {min} characters" }.
| Rule | Old (0.18) | New (0.19) |
|---|---|---|
minLength | Must be at least {min} characters | Minimum length is |
maxLength | Must be at most {max} characters | Maximum length is |
minLength with unit | Must be at least {min} | At least {min} |
maxLength with unit | Must be at most {max} | At most {max} |
minItems | Must be at least {min} items | At least {min} required |
maxItems | Must be at most {max} items | At most {max} allowed |
Native ports that run the conformance suite in packages/core/fixtures/conformance must use the new texts. The expected errors changed in scenarios/field-validation.json, scenarios/messages.json, scenarios/type-formats.json, scenarios/groups.json, scenarios/active-projection.json and trimmed-text.json.