Skip to content

7.0.0-beta.3

Pre-release
Pre-release

Choose a tag to compare

@heath-freenome heath-freenome released this 06 Dec 17:43
· 2 commits to main since this release
8f52406

New beta release

  • Newer JSON Schema drafts: the @rjsf/validator-ajv8/2019 and @rjsf/validator-ajv8/2020 entry points validate 2019-09 and 2020-12, and a schema declaring a draft its validator doesn't support fails every validation instead of being checked as the validator's own draft, so it has to import the matching entry point; the form reads dependentRequired and dependentSchemas as it reads dependencies
  • Tuples under conditions: a tuple a then, else or dependencies schema declares is met with the field's own tuple position by position instead of replacing it, and the items only unevaluatedItems describes render
  • Multi-selects: they read ui:definitions, ui:enumDisabled and ui:optgroups as a single select does, and offer the options each item's if/then/else allows
  • Schema utilities: the standalone schema functions are deprecated in favor of the methods on the SchemaUtilsType that createSchemaUtils() returns, and the ones only the v7 prereleases exported, such as getUiRequiredErrorSchema(), are removed
  • Precompiled validators: code generated with an earlier 7.0.0 beta has to be regenerated

@rjsf/core

  • BREAKING CHANGE: Change FormRef.reset() to show each anyOf/oneOf field on the option a form mounting on the seed shows, or the one it showed after the last reset(saved), where it kept the option the user picked if the data fit both. See the upgrade guide (#6008, #5944)
  • BREAKING CHANGE: Change Form to read dependentRequired and dependentSchemas as it reads dependencies, where it ignored both: the fields they bring render, take their defaults and are marked required. See the upgrade guide (#6013)
  • BREAKING CHANGE: Fix Form rendering an array field's tuple from the one a then, else or dependencies schema declares for it alone, leaving out the items past that tuple's length and each item's own constraints, where it now renders and fills each position from both, and offers each option of a oneOf/anyOf the field holds at a position merged with each option of one the branch holds there, as for items. See the upgrade guide (#6024, #6000, #5976)
  • Fix ArrayField rendering no field and no add button for the items past a prefixItems or items tuple that only unevaluatedItems describes, and Form dropping them under omitExtraData (#6011)
  • Fix Form throwing Could not find a definition for a $ref to an $anchor where the root schema declares no $schema (#6011)
  • Fix a Form passed formData reading clean once you change another field yourself, such as a city filled in after a lookup: a value you pass doesn't make the form dirty, and the user's own edits stay dirty (#6007, #6006)
  • Fix LayoutGridField rendering none of the cells of a discriminated oneOf/anyOf option that pins no discriminator value while the data holds none, or a value no option pins that the option takes, so picking that option in the selector did nothing (#6032, #6003)
  • Fix Form throwing No precompiled validator function was found under a validator from createPrecompiledValidator() when transformChange rewrites a switch to an anyOf/oneOf option merged from two lists (#6025, #5973)
  • Fix Form not marking a field as required, and live validation not reporting it, when a schema naming no type, the object's own or one nested in it such as a property, its items or a dependencies entry of it, lists it under required and a dependencies entry, a then/else or a merged option declares a required for that schema too (#6013)
  • Fix a multi-select, checkboxes included, ignoring ui:definitions, ui:enumDisabled and ui:optgroups where a single select of the same options reads them: it labels its options from the ui:definitions entry of each option's $ref and of its items' $ref, and reads ui:enumDisabled and ui:optgroups from its items or that entry; where the array sets one too, the array's wins (#6043, #6056, #6034, #6045)
  • Fix a multi-select offering the options its items' if/then/else allows the whole array rather than each item, such as only the else option where the if tests an item's value; an option the branch its own value takes doesn't list is offered only once it has been selected, and stays offered after it's cleared (#6056, #6044)
  • Add a development warning where a custom AnyOfField or OneOfField renders an anyOf/oneOf option its schema doesn't list, whose data Form fills, requires and omits by the schema's options, as in 6.11.1 (#6095, #6057, #6058, #6060, #6065)
  • Fix Form keeping the data of the anyOf/oneOf option switched away from where a custom AnyOfField or OneOfField hands the options to the default field in another order (#6095)

@rjsf/mantine

  • Fix BaseInputTemplate passing the largeStep and smallStep options Mantine 9.9 added to NumberInput on to a text input as unknown attributes, where a field renders one, such as with an inputType of tel (#6082)

@rjsf/shadcn

  • Change @radix-ui/react-radio-group to ^1.5.2 and @radix-ui/react-slider to ^1.6.2: the group of a disabled RadioWidget gains aria-disabled="true", and the slider of an enabled RangeWidget no longer has aria-disabled="false" (#6082)

@rjsf/utils

  • BREAKING CHANGE: Change retrieveSchema(), getDefaultFormState(), omitExtraData() and the other schema utilities to read dependentRequired and dependentSchemas as they read dependencies, where they ignored both. See the upgrade guide (#6013)
  • BREAKING CHANGE: Fix retrieveSchema() and getDefaultFormState() letting a tuple items or prefixItems that a then, else or dependencies schema declares replace a field's own tuple, dropping each position's own constraints and the positions past it, where the two are now met position by position, each position keeping the required of both as a single items does, and the options of a oneOf/anyOf both hold at a position are paired, as for items. See the upgrade guide (#6024, #6000, #5976)
  • Fix getItemSchema(), getDefaultFormState(), omitExtraData() and sanitizeDataForNewSchema() reading the items past a prefixItems or items tuple as undescribed where only unevaluatedItems describes them (#6011)
  • Fix retrieveSchema() and getDefaultFormState() throwing Could not find a definition for a $ref to an $anchor where the root schema declares no $schema, and createFieldTitleLookup() finding no title for a field under one, so applyValidatorErrorTitles() left its key in the error's message (#6011)
  • Add getOptionSelectorValue(), the value an anyOf/oneOf option's selector pins it to: its default, else its const, else the only entry of its enum (#6032, #6003)
  • Fix a validator from createPrecompiledValidator() throwing No precompiled validator function was found when the form scores an anyOf/oneOf option merged from two lists, such as a field's own and an allOf entry's or a then's, or from a list both options of such a pair hold, which needs precompiled code generated with 7.0.0-beta.2 regenerated, since getValidationSchemas() lists more schemas (#6018, #6025, #5979)
  • Change resolveUiSchema() to merge an option's ui:definitions entry at the option's written position in a schema retrieveSchema() narrowed, and add an entriesOrdered parameter for entries already in the narrowed order (#6029, #6010)
  • Add isValidOption(), which checks data against an anyOf/oneOf option retrieveSchema() returned as getFirstMatchingOption() checks it, also under a validator from createPrecompiledValidator() (#6025, #5973)
  • Change getValidationSchemas() to list two more kinds of schema for dependentSchemas: the condition each oneOf option of an entry is matched on, and the scoring copy of an anyOf/oneOf option whose only properties sit in an entry. Precompiled validator code generated with an earlier 7.0.0 beta for a schema holding dependentSchemas has to be regenerated (#6013)
  • Fix retrieveSchema() dropping the required of a schema naming no type, the object's own or one nested in it such as a property, its items or a dependencies entry of it, when a dependencies entry, a then/else or a merged option declares a required for it too: the two lists are now joined (#6013)
  • Change retrieveSchema() to hand out the schema it retrieved for a field again for other data its ifs, dependencies and options decide alike, so the rows of a list taking the same branches are retrieved once rather than once per row (#6064)
  • Fix retrieveSchema() returning a declared property that a patternProperties entry also matches, or the option selectedOption names, as built for an earlier call's data, where its own if, dependencies or extra keys depend on its value (#6064)
  • Deprecate the standalone findFieldInSchema(), findSelectedOptionInXxxOf(), getClosestMatchingOption(), getDefaultFormState(), getFirstMatchingOption(), getFromSchema(), isFilesArray(), isMultiSelect(), isSelect(), omitExtraData(), retrieveSchema() and sanitizeDataForNewSchema(), kept through v7: call the method of the same name on the SchemaUtilsType that createSchemaUtils() returns. See the upgrade guide (#6070, #6068)
  • Remove the standalone childFillOf(), constrainsAlike(), getFieldDefault(), getFilledDefault() and getUiRequiredErrorSchema(), which only the v7 prereleases exported: call the method of the same name on the SchemaUtilsType that createSchemaUtils() returns (#6070, #6068)
  • Fix the UiSchema type rejecting what works at runtime: a registered template's name or null as a ui:*Template value, and a uiSchema.items function returning null or undefined for an item's default UI (#6076, #6072)

@rjsf/validator-ajv8

  • BREAKING CHANGE: Change a schema whose $schema names a draft its validator doesn't support to no longer be validated as the validator's own draft, including where it has a oneOf, anyOf or if: every validation reports one error that says what to change, such as the entry point to import the validator from, in place of no schema with key or ref "…", and compileSchemaValidators() throws it too, naming the AjvClass to pass. isValid(), which still matches options and conditions against a root schema declaring such a draft, logs one console warning that says the same. See the upgrade guide (#6009, #3750)
  • Fix errors under a $ref to an $anchor not naming their property by the label the form shows it with, where the root schema declares no $schema (#6011)
  • Add the @rjsf/validator-ajv8/2019 and @rjsf/validator-ajv8/2020 entry points, whose default export and customizeValidator() validate JSON Schema 2019-09 and 2020-12, so an app no longer imports an Ajv class from ajv for them (#6009, #3750)

@rjsf/validator-ata

  • BREAKING CHANGE: Fix data reaching a $ref that names nothing passing validation under not, if, a oneOf branch or a contains with maxContains and minContains: 0, or naming a document by URI in an additionalMetaSchemas or ataOptionsOverrides.schemas entry. Under not, if, a oneOf branch, contains with maxContains, or in a schema with unevaluatedProperties or unevaluatedItems, the whole validation now fails with one cannot resolve $ref error on the root; elsewhere in an entry, a $ref naming a document by URI fails the field with it. A precompiled validator throws was not compiled to a standalone validator. See the upgrade guide (#6040, #6014)
  • BREAKING CHANGE: Fix data reaching a $ref to a root $id that is only a fragment and no anchor, such as $ref: '#1' in a root with $id: '#1', passing validateFormData() with only its first level checked. It now fails with cannot resolve $ref #1; a precompiled validator still reads the $ref as the root. See the upgrade guide (#6040)
  • Fix errors under a $ref to an $anchor not naming their property by the label the form shows it with, where the root schema declares no $schema (#6011)
  • Change ata-validator to ^1.66.1, which fixes other cases where validation accepted data it should reject, and lets ataOptionsOverrides set patternFallback. In a browser or edge build, a value other than 'platform' needs import 'ata-validator/pattern-fallback' in the app, with ata-validator as a direct dependency under pnpm. compileSchemaValidatorsCode() leaves out a patternFallback function with a warning, as it does keywords, and under 'reject' throws for a pattern outside ata's linear-time engine (#6040, #6014)
  • Fix the form showing the else branch of an if whose $ref names a definition by a name holding a lone surrogate, such as 'a\uD800b' (#6040)

@rjsf/validator-cfworker

  • Fix errors under a $ref to an $anchor not naming their property by the label the form shows it with, where the root schema declares no $schema (#6011)
  • Change @cfworker/json-schema to ^4.1.8, which rejects a uri whose authority after // is invalid, such as the port of http://example.com:abc/path, and a uri-reference such as //example.com:abc/path, where it read them as paths (#6082)