Skip to content

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.

bash
npm i @formhaus/core@^0.19 @formhaus/react@^0.19
npm i @formhaus/core@^0.19 @formhaus/vue@^0.19

Changes ​

AreaOld (0.18)New (0.19)Action
TypesA field with type rating was a custom type: no type check, your component from componentsrating 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 entryRename a custom type to a dashed name, such as x-rating, in the definition and in components
TypesA field with type scale was a custom typescale is built in: the value must be a whole number from validation.min to validation.maxRename a custom type to a dashed name, such as x-scale
ChecksNoneA 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 11Keep the range within 2 to 11 whole-number points
ChecksNoneAn option image that does not start with https: or data:image/ is an unsafe-image-url warningServe option images over https
FormatFORMAT_VERSION was "1.2""1.3"Set "formatVersion": "1.3" on definitions with scale or rating
TypesDefaultFieldType had 17 namesIt adds scale and ratingAdd scale and rating to an exhaustive Record<DefaultFieldType, …>, such as a component map
Checksunknown-field-type compared a dashed type with the built-in names by spelling distance, so x-rating was reported as a typo of ratingA type with - or : is reported only when it is a built-in name with separators, such as multi-selectNone
InstallNode 20Node 22.12 or later for @formhaus/core, react, vue, mcp and formhausUpgrade 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" }.

RuleOld (0.18)New (0.19)
minLengthMust be at least {min} charactersMinimum length is
maxLengthMust be at most {max} charactersMaximum length is
minLength with unitMust be at least {min}At least {min}
maxLength with unitMust be at most {max}At most {max}
minItemsMust be at least {min} itemsAt least {min} required
maxItemsMust be at most {max} itemsAt 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.