Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose title/ui:title in RJSFValidationError #4504

Open
1 task done
TheOneTheOnlyJJ opened this issue Feb 22, 2025 · 0 comments
Open
1 task done

Expose title/ui:title in RJSFValidationError #4504

TheOneTheOnlyJJ opened this issue Feb 22, 2025 · 0 comments
Labels
feature Is a feature request needs triage Initial label given, to be assigned correct labels and assigned

Comments

@TheOneTheOnlyJJ
Copy link

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.

@TheOneTheOnlyJJ TheOneTheOnlyJJ added feature Is a feature request needs triage Initial label given, to be assigned correct labels and assigned labels Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is a feature request needs triage Initial label given, to be assigned correct labels and assigned
Projects
None yet
Development

No branches or pull requests

1 participant