Expose title
/ui:title
in RJSFValidationError
#4504
Labels
feature
Is a feature request
needs triage
Initial label given, to be assigned correct labels and assigned
Prerequisites
What theme are you using?
mui
Is your feature request related to a problem? Please describe.
I have a field named
confirmPassword
, which has itsui:title
set to"Confirm Password"
.I want to have a custom
errorTransformer
which does a bit of dynamic composition.It should change the error message and append the title at the end, nothing special.
The problem is that I cannot easily retrieve the
ui:title
from theRJSFValidationError
object:Notice how the
ui:title
is only present in themessage
andstack
properties, without an easy way to dynamically extract it for composing other error messages.Describe the solution you'd like
The most straightforward solution would be to add a new field to
RJSFValidationError
namedtitle
, which takes the property'stitle
value from either the JSON Schematitle
or the UI Schemaui:title
(withui:title
taking precedence overtitle
maybe?).Alternatively, adding an entire
uiOptions
field containing the correspondingui:options
(like returned bygetUiOptions
) for the property would cover even more use cases than exposing just thetitle
.Describe alternatives you've considered
I have tinkered around with
getUiOptions
, but dynamically accessing the property given how they are not always standardized in theproperty
field (sometimes the property name is preceded by a dot, sometimes not) proved a great hassle.The text was updated successfully, but these errors were encountered: