Open hirenr opened 10 months ago
For your use case the ui:title
is applied to both because the oneOf
is considered the same level as the root. Our uiSchema
does not support the JSON Schema branches, instead it behaves more like formData
in that it is flatten to the view structure. I'm not sure we can easily make the uiSchema
do what you want. What is your use case for renaming the titles?
Well, I do not define the json schema. It is part of a cross-industry accepted format. format example
I need to build the a form where I can choose one of the "oeOf" items in a select field. The object within the oneOf list, is a fairly complex format with its own title. The example in the above post is derived from the xarf schema url.
In an ideal case, I just pass on the JsonSchema to rjsf with my own uiSchema to build a more human readable/understandable form.
The idea is to build something like abuse.cloudflare.com form with a select field at the top. In my case, the top level title would be renamed to "Choose an Abuse Report" and the next level title into the names of the individual type of reports.
Hope i make sense!
If you don't have a title/description on the Root schema then you should be able to programmatically change the ui:title
to be more relevant for the selected schema. You could keep the main title outside of the Form
as a div
or something to avoid the duplication
True. That is exactly what I am planning to do. Keep the main title outside the schema. But this requires me to refactor an incoming schema that I do not own. I believe I cannot even selectively hide the root title. I wanted to just point to the public url of the schema by the schema owner.
Does ui:hideLabel: true
on the root work?
Prerequisites
What theme are you using?
core
What is your question?
Hi, I am quite new to rjsf. I have a query that is leaving me stumped. ui:title is overriding both the nested titles. I just want to change one or the other specifically. How do i do that?
Schema:
uiSchema:
Output:![image](https://github.com/rjsf-team/react-jsonschema-form/assets/20088337/b9d1b22a-4a18-4261-ab72-b1a2d4f0e14e)
uiSchema:
Output:![image](https://github.com/rjsf-team/react-jsonschema-form/assets/20088337/9d5311f6-a2a3-4174-8e76-98aad0f8b18a)