jsonforms
jsonforms copied to clipboard
Fix conditionally required property not applying
This PR fixes the long lasting problem of having conditionally required properties in the schema that do not show as required in the UI. It addresses issue #1390.
Deploy Preview for jsonforms-examples ready!
| Name | Link |
|---|---|
| Latest commit | c3d333f5f2746946f9bd255cf1c561e9b06ae9ad |
| Latest deploy log | https://app.netlify.com/sites/jsonforms-examples/deploys/66cd9c753109b100086982e5 |
| Deploy Preview | https://deploy-preview-2228--jsonforms-examples.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
coverage: 85.591% (+2.5%) from 83.078% when pulling ec4273a7161997af459873041af63f89c22ac65a on gatanasov-asteasolutions:master into b00754cf4c186963ba141c11367f528c9bd5c7e4 on eclipsesource:master.
Thank you very much for the contribution :heart:. We will soon take a look.
I'm wondering whether we should
make this behavior optional (default: false), and/or
introduce a generic prop-adaption mechanism. Then this "advanced"
requiredanalysis could be manually configured by the user if they need it.
- Of course then we could already provide this adapter for them.
Once we introduce this, there will be a lot of follow up requests. For example it's a bit arbitrary that we only do this for
requiredand not for other attributes too, e.g.title. So I'm leaning a bit to the generic prop-adaption mechanism which would allow for arbitrary behavior while keeping JSON Forms itself slim.What do you think?
The most appropriate place for me to add this toggle of these dynamic checks is the config property of the JsonForms component. It is an easy way to provide the users with the option to enable them only on specific schemas, just like they can use it to disable the asterisk. Also they can use the same property to enable future dynamic checks for other fields, if there appear to be any. I have added this functionality in my latest commit.
Hi @gatanasov-asteasolutions, we were currently busy with the 3.2 release. We will discuss this proposal and what we think what the best way forward is within the team in the upcoming weeks and let you know.
In the mean time:
- If you would like to contribute the "prop-adaption" mechanism to accomplish this feature for your renderers in a convenient way, then feel free to do so
- If you would like to already consume your contributed mechanism, then you can do so via custom renderers. In there you can call the current bindings of JSON Forms and then just apply the "conditionally required property" evaluation on top.