-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ui:options not behaving as expected from the documentation #2535
Comments
This might be a bug? Perhaps if "ui:title" / "ui:description" are
hard-coded in some of the theme code
…--
Ashwin Ramaswami
On Thu, Sep 2, 2021 at 8:56 AM Mourad BEJI ***@***.***> wrote:
Prerequisites
- I have read the documentation
<https://react-jsonschema-form.readthedocs.io/>;
- In the case of a bug report, I understand that providing a SSCCE
<http://sscce.org/> example is tremendously useful to the maintainers.
- Ideally, I'm providing a sample JSFiddle
<https://jsfiddle.net/n1k0/f2y3fq7L/6/> or a shared playground link
<https://rjsf-team.github.io/react-jsonschema-form/> demonstrating the
issue.
Description
Hello ! I'm sorry if I missed something, but in the documentation
<https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/>
it seems to state that {"ui:options": {[property]: [value]}} and {"ui:[property]":
value} are equivalent. When I try this locally or on your playground
though, I'm having a different behaviour where the ui:options does not
seem to be read.
Steps to Reproduce
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6e30sInNjaGVtYSI6eyJ0aXRsZSI6IkEgcmVnaXN0cmF0aW9uIGZvcm0iLCJkZXNjcmlwdGlvbiI6IkEgc2ltcGxlIGZvcm0gZXhhbXBsZS4iLCJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJuYW1lIjp7InR5cGUiOiJzdHJpbmcifX19LCJ1aVNjaGVtYSI6eyJ1aTpvcHRpb25zIjp7InRpdGxlIjoiVGl0bGUiLCJkZXNjcmlwdGlvbiI6IkRlc2NyaXB0aW9uIn0sIm5hbWUiOnsidWk6b3B0aW9ucyI6eyJ0aXRsZSI6IkN1c3RvbSB0aXRsZSIsImRlc2NyaXB0aW9uIjoiY3VzdG9tIGRlc2MifX19LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsidmFsaWRhdGUiOmZhbHNlLCJkaXNhYmxlIjpmYWxzZSwib21pdEV4dHJhRGF0YSI6ZmFsc2UsImxpdmVPbWl0IjpmYWxzZX19
Expected behavior
uiSchema["ui:options].title and uiSchema["ui:options].description should
be taken into account and override the field title that is in the json
schema
Actual behavior
uiSchema["ui:options"] seem to be ignored for these ui options.
Version
3.1.0
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2535>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAM4MXYIXO56VVDUI2RCDULT75X75ANCNFSM5DJBNURA>
.
|
It seems they are hardcoded in the core library indeed, e.g. I'm not very familiar with the code, but there seems to be a util function to merge the ui options from the different locations. I guess that should be used everywhere we need to read from the uiSchema ? |
Yes, that seems like the right solution. Would you be willing to make a PR that fixes this issue wherever it's found in the codebase? |
I don't have enough knowledge of the codebase and bandwidth right now to do this unfortunately. Especially since it is easy to work around this issue by directly using |
I have created a fix for this waiting in PR , @bejito it would be great if you could check it out as well. |
…rray description and title Fix rjsf-team#2535 by reimplementing rjsf-team#2537 - In `@rjsf/utils`, updated the props for the description and title templates to add `schema` - Also made the `title` and `description` for the array field description and title props as optional - In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition - In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false - Updated the tests to verify this change - Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing - Updated the `contributing.md` file to improve developer documentation - Updated the `CHANGELOG.md` file accordingly
…rray description and title Fix rjsf-team#2535 by reimplementing rjsf-team#2537 - In `@rjsf/utils`, updated the props for the description and title templates to add `schema` - Also made the `title` and `description` for the array field description and title props as optional - In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition - Deleted the tests for `DescriptionField` and `TitleField` in the `bootstrap-4` theme because they broke, and are redundant anyway given the other tests - In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false - Updated the tests to verify this change - Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing - Updated the `contributing.md` file to improve developer documentation - Updated the `CHANGELOG.md` file accordingly
…rray description and title Fix rjsf-team#2535 by reimplementing rjsf-team#2537. Also fixes rjsf-team#3176 by passing uiSchema and schema to the description and title templates. - In `@rjsf/utils`, updated the props for the description and title templates to add `schema` - Also made the `title` and `description` for the array field description and title props as optional - In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition - Deleted the tests for `DescriptionField` and `TitleField` in the `bootstrap-4` theme because they broke, and are redundant anyway given the other tests - In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false - Updated the tests to verify this change - Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing - Updated the `contributing.md` file to improve developer documentation - Updated the `CHANGELOG.md` file accordingly
…ription and title (#3191) Fix #2535 by reimplementing #2537. Also fixes #3176 by passing uiSchema and schema to the description and title templates. - In `@rjsf/utils`, updated the props for the description and title templates to add `schema` - Also made the `title` and `description` for the array field description and title props as optional - In all of the themes, ensured that the `schema` is now passed to the all the calls to the description and title templates - With the exception of the `antd` theme, removed the logic for conditionally rendering the `ArrayFieldDescriptionTemplate` since that template already handles the condition - Deleted the tests for `DescriptionField` and `TitleField` in the `bootstrap-4` theme because they broke, and are redundant anyway given the other tests - In `@rjsf/core`, updated the `ArrayFieldDescriptionTemplate` and `ArrayFieldTitleTemplate` to not render the template when `ui:label` is false - Updated the tests to verify this change - Updated the `custom-templates.md` file to document the new `schema` prop and add the `uiSchema` prop docs where missing - Updated the `contributing.md` file to improve developer documentation - Updated the `CHANGELOG.md` file accordingly
Prerequisites
Description
Hello ! I'm sorry if I missed something, but in the documentation it seems to state that
{"ui:options": {[property]: [value]}}
and{"ui:[property]": value}
are equivalent. When I try this locally or on your playground though, I'm having a different behaviour where theui:options
does not seem to be read.Steps to Reproduce
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6e30sInNjaGVtYSI6eyJ0aXRsZSI6IkEgcmVnaXN0cmF0aW9uIGZvcm0iLCJkZXNjcmlwdGlvbiI6IkEgc2ltcGxlIGZvcm0gZXhhbXBsZS4iLCJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJuYW1lIjp7InR5cGUiOiJzdHJpbmcifX19LCJ1aVNjaGVtYSI6eyJ1aTpvcHRpb25zIjp7InRpdGxlIjoiVGl0bGUiLCJkZXNjcmlwdGlvbiI6IkRlc2NyaXB0aW9uIn0sIm5hbWUiOnsidWk6b3B0aW9ucyI6eyJ0aXRsZSI6IkN1c3RvbSB0aXRsZSIsImRlc2NyaXB0aW9uIjoiY3VzdG9tIGRlc2MifX19LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsidmFsaWRhdGUiOmZhbHNlLCJkaXNhYmxlIjpmYWxzZSwib21pdEV4dHJhRGF0YSI6ZmFsc2UsImxpdmVPbWl0IjpmYWxzZX19
Expected behavior
uiSchema["ui:options].title
anduiSchema["ui:options].description
should be taken into account and override the field title that is in the json schemaActual behavior
uiSchema["ui:options"]
seem to be ignored for these ui options.Version
3.1.0
The text was updated successfully, but these errors were encountered: