Repository navigation
v5.4.0
See Upgrading to 5.4 for what apps need to
change.
Behaviour changes
- server: Validation errors carry the messages of
@ditojs/schemathat the admin shows, instead of Ajv's, e.g. "must be 5 or more" instead of "must be >= 5". Theirkeywordandparamsstay the same: clients that match message texts need to match those instead. - admin: Several fields of the same value, e.g. in two tabs, take each aspect, e.g.
defaultorserializeValue(), from the first field in form order that defines it. All of them validate the value, and items are sent with the values of all their forms. - admin: Validation follows the server, with the definitions of
@ditojs/schema:maxLengthis validated, counted in characters, not only set as themaxlengthof inputs: saving fails where code wrote longer values.requiredaccepts empty arrays, except on types whose empty value is an array, e.g. lists,checkboxes, multiselects and uploads withmultiple.minimum,maximumandrangeonly apply to numbers.urlfields require a scheme:example.comfails,https://example.compasses.date,datetimeandtimefields reject invalid dates, e.g.new Date('soon')or'14:30', with "must be a valid date".select,multiselect,radioandcheckboxeswith options given as an array reject values missing from them, with "must be one of the options". Options from callbacks ordataPath, and multiselects withtaggableorsearch, still accept them.integersays "must be a whole number", anddecimalse.g. "must be a number with at most 2 decimal places".
- admin: Empty values:
markupstores an empty editor asnullinstead of e.g.<p></p>,codesendsnullinstead of''when emptied, anduploadwithmultipleholds[]instead ofnullwhile it has no value.
Deprecations
- server:
app.compileValidator()is deprecated in favour ofapp.compileJsonSchema(). - admin: The
rulesof fields are deprecated: use field keys for limits, e.g.minimumormaxLength, the type for type checks, andvalidate()for the rest, see Types and limits of fields. - admin:
minandmaxof number types are deprecated aliases ofminimumandmaximum. Custom types returnminimumandmaximumfromgetValidations().
New
- server:
app.compileDitoSchema()compiles schemas in the format of model properties, andapp.compileJsonSchema()plain JSON schemas, see Validation. - admin:
context.getErrors(match?)returns the errors of the data by data path, e.g. for the markup ofuseDitoForm()pages. - admin: Fields take
minLength,pattern,minItemsandmaxItems, and number typesminimumandmaximum, as the server's model properties do. - admin:
nullable: falseon string fields andcheckboxstores no value as''orfalseinstead ofnull. - schema: New package
@ditojs/schemawith the formats and keywords that the server and the admin share.
Fixes
- admin, forms:
- Leaving a form with unsaved changes asks "Do you want to discard them?" instead of "Do you really want to cancel?".
- Edits of fields in the panels of lists and other sources mark the form as unsaved.
- Values merged into the data, e.g. with
context.mergeItem(), replace the errors of fields in panels too.
- admin, fields: Clear buttons don't show for
''.