Skip to content

Expose title/ui:title in RJSFValidationError #4504

Open
@TheOneTheOnlyJJ

Description

@TheOneTheOnlyJJ

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 its ui: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 the RJSFValidationError object:

Image

Notice how the ui:title is only present in the message and stack 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 named title, which takes the property's title value from either the JSON Schema title or the UI Schema ui:title (with ui:title taking precedence over title maybe?).

Alternatively, adding an entire uiOptions field containing the corresponding ui:options (like returned by getUiOptions) for the property would cover even more use cases than exposing just the title.

Describe alternatives you've considered

I have tinkered around with getUiOptions, but dynamically accessing the property given how they are not always standardized in the property field (sometimes the property name is preceded by a dot, sometimes not) proved a great hassle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions