@rjsf/utils
Advanced tools
Changelog
5.0.0-beta.19
MultiSchemaField
to cache options with refs in state and to output better labels for options without them when a title is available in either the schema
or uiSchema
ui:fieldReplacesAnyOrOneOf
flag to the uiSchema
that when true will allow users to opt-out of the anyOf
/oneOf
wrapping of a custom fieldtoPathSchema()
to handle oneOf
/anyOf
by picking the closest option and generating the path for it, fixing #2262uiSchema
only flag ui:fieldReplacesAnyOrOneOf
that, if true allows the user to opt-out of the anyOf
/oneOf
wrapping of a custom fielduiSchema
documentation for ui:fieldReplacesAnyOrOneOf
Changelog
5.0.0-beta.18
MultiSchemaField
to utilize the new getClosestMatchingOption()
and sanitizeDataForNewSchema()
functions, fixing the following issues:
ObjectField
to deal with additionalProperties
with oneOf
/anyOf
, fixing #2538Form
, MultiSchemaField
, ObjectField
and SchemaField
to properly support making formData
optional, fixing #3305SelectWidget
label only if value is not empty, fixing #3369SelectWidget
label only if value is not empty, fixing #3369getClosestMatchingOption()
, getFirstMatchingOption()
and sanitizeDataForNewSchema()
schema-based utility functions
getMatchingOption()
and updated all calls to it in other utility functions to use getFirstMatchingOption()
stubExistingAdditionalProperties()
to deal with additionalProperties
with oneOf
/anyOf
, fixing #2538getSchemaType()
to grab the type of the first element of a oneOf
/anyOf
, fixing #1654T
to allow for them to be optionally provided, fixing #3305
formData
was required as a function argument to make it optional, fixing #3305formData
was required as a function argument to make it optional, fixing #3305onFormDataEdited()
to only change the formData in the state if the JSON.stringify()
of the old and new values are different, partially fixing #3236npm start
command to always use the --force
option to avoid issues where changes made to other packages weren't getting picked up due to vite
cachingutility-functions
and the 5.x upgrade guide
to add the new utility functions and to document the deprecation of getMatchingOption()
utility-functions
, making all optional parameters without a default (as denoted by the syntax [<parameter>]: <type>
) to add | undefined
onto the type to make it clear it supports passing in undefined as a value.Changelog
5.0.0-beta.17
SelectWidget
by the label that the user sees rather than by the valuestyle
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapper, partially fixing #1200aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
style
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapper, partially fixing #1200CheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
style
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapper, partially fixing #1200CheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
SchemaField
to handle the new style
prop in the uiSchema
similarly to classNames
, passing it to the FieldTemplate
and removing it from being passed down to children.
style
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapperCheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
style
prop on FieldTemplate
rendering them on the outermost wrapper, partially fixing #1200CheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
SelectWidget
to support additional TextFieldProps
in a manner similar to how BaseInputTemplate
doesstyle
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapper, partially fixing #1200CheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
SelectWidget
to support additional TextFieldProps
in a manner similar to how BaseInputTemplate
doesstyle
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapper, partially fixing #1200CheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
style
prop on FieldTemplate
and WrapIfAdditionalTemplate
rendering them on the outermost wrapper, partially fixing #1200CheckboxesWidget
to treat the value as an array when selecting/deselecting values and when determining the checked state - fixing #2141aria-describedby
value built using the ariaDescribedByIds()
function, partially fixing #959
FieldTemplateProps
, WrapIfAdditionalTemplateProps
and UIOptionsBaseType
types to add style?: StyleHTMLAttributes<any>
, partially fixing #1200enumOptionsDeselectValue()
and enumOptionsSelectValue()
as a loose refactor of the duplicated functions in the various CheckboxesWidget
implementationsFieldTemplateProps
, WrapIfAdditionalTemplateProps
and UIOptionsBaseType
types to add style?: StyleHTMLAttributes<any>
, partially fixing #1200ariaDescribedByIds()
, descriptionId()
, errorId()
, examplesId()
, helpId()
optionId()
and titleId()
id generator functionsAJV8Validator#transformRJSFValidationErrors
to return more human-readable error messages. The ajv8 ErrorObject
message is enhanced by replacing the error message field with either the uiSchema
's ui:title
field if one exists or the parentSchema
title if one exists. Fixes #3246preserveSymlinks
to true
, which provides an alternative fix for #3228 since the prior fix caused #3215.custom-templates.md
and uiSchema.md
to document the new style
propvalidation.md
documentation to describe the new uiSchema
parameter passed to the customValidate()
and transformError()
functionsutility-functions
documentation to add the new enumOptionsDeselectValue()
and enumOptionsSelectValue()
functions and to describe the new id generator functions5.x migration guide
documentation to describe potential breaking id
changesChangelog
5.0.0-beta.16
ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072withConfigConsumer
with the ConfigConsumer
component instead, fixing #3336ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
to get the required
state of the checkbox from the schemaRequiresTrueValue()
utility function rather than the required
prop, fixing #3317CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
to get the required
state of the checkbox from the schemaRequiresTrueValue()
utility function rather than the required
prop, fixing #3317CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314
registry
into the SubmitButton
inside of the Form
as part of this fixArrayField
to pass the new totalItems
and canAdd
props to the ArrayFieldItemTemplate
instances, fixing #3315
onAddClick
and onAddIndexClick
into a new _handleAddClick()
function, fixing #3316ValidatorType
, CustomValidator
and ErrorTransformer
to add the new generics, as well as passing uiSchema
to the validateFormData()
call, partially fixing #3170ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072ButtonTemplates
to pass the new required registry
prop, filtering it out in the actual implementations before spreading props, fixing - #3314CheckboxWidget
to get the required
state of the checkbox from the schemaRequiresTrueValue()
utility function rather than the required
prop, fixing #3317
CheckboxWidget
missing label issue #3302CheckboxWidget
validating that the schema.title
is passed as the label, fixing #3302generateXXX
functions for Form
, Theme
, Templates
and Widgets
to support using the theme with user-specified type generics, partially fixing #3072SubmitButtonProps
and IconButtonProps
to add required registry
prop, fixing - #3314ArrayFieldTemplateItemType
to add the new totalItems
and canAdd
props, fixing #3315CustomValidator
and ErrorTransformer
types to take the full set of T
, S
, F
generics in order to accept a new optional uiSchema
property, partially fixing #3170ValidatorType
to add the F
generic to allow the validateFormData()
function to take a new optional uiSchema
parameter, partially fixing #3170
ValidatorType
interface changecustomizeValidator
and AJV6Validator
implementations to add the S
and F
generics, so that validateFormData()
can accept a new optional uiSchema
parameter that is passed to transformErrors()
and customValidate()
, partially fixing #3170customizeValidator
and AJV8Validator
implementations to add the F
generic, so that validateFormData()
can accept a new optional uiSchema
parameter that is passed to transformErrors()
and customValidate()
, partially fixing #3170ArrayFieldItemTemplate
, SubmitButtonProps
and IconButtonProps
as part of the fix for #3314 and #3315form-props.md
for children
, fixing #3322typescript.md
documentation to Advanced Customization
describing how to use custom generics as part of the fix for #3072utilty-functions.md
to add the new F
generic to all the places which needed themChangelog
5.0.0-beta.15
schema
along to the ArrayFieldItemTemplate
as part of the fix for #3253onChange
handler in the RangeWidget
, fixing #2161onChange
handler in the RangeWidget
, fixing #2161ArrayFieldItemTemplate
to add schema
as part of the fix for #3253allOf
s (#3025, #3227), fixing #2923ErrorSchemaBuilder
class to enable building a proper ErrorSchema
without crazy castings, fixing #3239ErrorSchemaBuilder
in the toErrorSchema()
function to simplify the implementationErrorSchemaBuilder
in the toErrorSchema()
function to simplify the implementationErrorSchema
, fixing #3260Changelog
5.0.0-beta.14
ref
definition to ThemeProps
fixing #2135onChange
handler in Form
to use the new preventDuplicates
mode of mergeObjects()
when merging extraErrors
when live validation is off, fixing #3169computedDefaults
(used by getDefaultFormState
) to skip saving the computed default if it's an empty object unless includeUndefinedValues
is truthy, fixing #2150 and #2708getDefaultFormState
util's includeUndefinedValues
prop to accept a boolean or "excludeObjectChildren"
if it does not want to include undefined values in nested objectsmergeObjects
to add new preventDuplicates
mode when concatenating arrays so that only unique values from the source object array are copied to the destination object arrayisObject
to correctly identify 'Date' as not an object, similar to 'File', thus preventing them from being merged with Object default values.Changelog
5.0.0-beta.13
$id
s, use a pre-compiled Ajv validation function when available.$id
s, fixing #2821.Changelog
5.0.0-beta.12
@rjsf/validator-ajv8
fixing #3110@rjsf/validator-ajv8
fixing #3110@rjsf/validator-ajv8
fixing #3110false
, top
or bottom
; true
is no longer a valid value as the default changed from true
to top
#634S extends StrictRJSFSchema = RJSFSchema
, for schema
/rootSchema
to every component that needed it.@rjsf/validator-ajv8
fixing #3110F = any
generic to be F extends FormContextType = any
to better support how formContext
is defined and used, partially fixing #3072@rjsf/validator-ajv8
fixing #3110@rjsf/validator-ajv8
fixing #3110@rjsf/validator-ajv8
fixing #3110@rjsf/validator-ajv8
fixing #3110schema
/rootSchema
to add the generic S extends StrictRJSFSchema = RJSFSchema
and use S
as the type for them.
StrictRJSFSchema
was added as the alias to JSON7Schema
and RJSFSchema
was modified to be StrictRJSFSchema & GenericObjectType
F = any
generic because it is assumed that more people will want to change the schema than the formContext typesValidatorType
interface to add a new rawValidation()
method for use by the playgroundFormContextType
alias to GenericObjectType
and changing the F = any
generic to be F extends FormContextType = any
to better support how formContext
is defined and used, partially fixing #3072RJSFSchema
type change@rjsf/validator-ajv8
rawValidation()
function for use by the playgroundS extends StrictRJSFSchema = RJSFSchema
generic and fixed up type castsAjvClass
prop to the CustomValidatorOptionsType
to support using the Ajv2019
or Ajv2020
class implementation instead of the default Ajv
class; fixing #3189rawValidation()
function for use by the playground5.x upgrade guide
and utility-functions.md
to document the new StrictRJSFSchema
, the S
generic and changing the F
generic extendvalidation
guide to document the new AjvClass
prop on CustomValidatorOptionsType
and mentioning the deprecation of @rjsf/validator-ajv6
draft-2019-09
and draft-2020-12
schemas and to make the AJV8
validator the default validator, marking AJV6
as deprecated@rjsf/validator-ajv8
validator as the defaultChangelog
5.0.0-beta.11
FieldTemplate
to no longer render additional, unnecessary white space for fields that have empty help
and extra
information, fixing #3147ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176FieldTemplate
instead of having the widgets implementing the label, fixing #2007ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176chakra-react-select
v4, fixing #3152SelectWidget
use Select
from chakra-react-select
for both single- and multiple-choice selectSelectWidget
multiple-choice select display label rather than value for selected itemsArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176Form.onChange
to optionally return the id
of the field that caused the change, fixing #2768additionalProperties
was true
(#3719).ArrayFieldDescriptionTemplate
and ArrayFieldTitleTemplate
to not render content when ui:label
is false, fixing #2535ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176ArrayFieldTemplate
to always render ArrayFieldDescriptionTemplate
since that template deals with the optional description
schema
into the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
, fixing #3176onChange
prop on FieldProps
and FieldTemplateProps
to add an optional id
parameter to the callback.DescriptionFieldProps
and TitleFieldProps
to add a new required schema
prop. Also updated the ArrayFieldDescriptionTemplate
and ArrayFieldTitleTemplate
to make description
and title
optional while pulling all the other props but id
from the associated type.id
of the field being changed on the onChange
handlerform-props.md
to describe the new id
parameter being returned by the Form.onChange
handlercustom-templates.md
to add the new schema
prop to the ArrayFieldDescriptionTemplate
, ArrayFieldTitleTemplate
, DescriptionFieldTemplate
and TitleFieldTemplate
documentationcontributing.md
to describe setting up the husky
precommit hooks for the first time git clone
of the repo; Also added guidance for developing on underpowered computers; Finally discussed code-coverage requirements for some packages.Changelog
5.0.0-beta.10
WrapIfAdditional
to WrapIfAdditionalTemplate
name
to the input
components that were missing it to support remix
CheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, protecting against non-arraysantd
to Typescript, indirectly fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/3123)WrapIfAdditional
to WrapIfAdditionalTemplate
name
to the input
components that were missing it to support remix
CheckboxWidgets
code to eliminate a ternary in favor of a simple inline={inline}
property since all the rest of the props were the sameCheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, removing unnecessary casts to any
and protecting against non-arraysCheckboxesWidget
incorrectly rendered inner <form>
elements around each checkbox, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/2355)WrapIfAdditional
to WrapIfAdditionalTemplate
name
to the input
components that were missing it to support remix
CheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, removing unnecessary casts to any
and protecting against non-arraysWrapIfAdditional
to WrapIfAdditionalTemplate
name
to the input
components that were missing it to support remix
CheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
validate()
method on Form
to make schemaUtils
an optional third parameter rather than a required first parameter, making the signature backwards compatible with what was provided in previous versions.WrapIfAdditionalTemplate
. additionalProperties
is currently not supported in @rjsf/fluent-ui
(See #2777).name
or id
(for those fluent components not supporting name) to the input
components that were missing it to support remix
DateTimeWidget
to properly use BaseInputTemplate
rather than TextWidget
CheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, removing unnecessary casts and protecting against non-arrays, fixing (https://github.com/rjsf-team/react-jsonschema-form/issues/2138)RadioWidget
so that it supports read-only and disabled statesWrapIfAdditional
to WrapIfAdditionalTemplate
name
to the input
components that were missing it to support remix
CheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, removing unnecessary casts to any
and protecting against non-arraysWrapIfAdditional
to WrapIfAdditionalTemplate
name
to the input
components that were missing it to support remix
CheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, removing unnecessary casts to any
and protecting against non-arraysWrapIfAdditional
to WrapIfAdditionalTemplate
ArrayFieldTemplate
and ObjectFieldTemplate
's AddButton
to show the non-labeled version. (https://github.com/rjsf-team/react-jsonschema-form/pull/3142)name
to the input
components that were missing it to support remix
, including fixing incorrect name
s as id
s in some situationsCheckboxesWidget
and RadioWidget
to have unique id
s for each radio element by appending the option.value
, protecting against non-arrayssemantic-ui
to TypescriptWrapIfAdditionalTemplate
and WrapIfAdditionalTemplateProps
to simplify theming and make it easier to override Field behavior for schemas with additionalProperties
.