jsonforms
jsonforms copied to clipboard
using '/' in initialisation json results in 'No applicable renderer found.'
Describe the bug using '/' in initialisation json results in 'No applicable renderer found.'
To Reproduce
- Use JsonForms data json
{
"some / initial / value": 0.0,
}
- load form
- Cell does not display with error 'No applicable renderer found.'
Expected behavior Cell to display
Screenshots
Browser (please complete the following information):
- Browser - chrome latest
Used Setup (please complete the following information):
- Framework: react
- RendererSet: material
Additional context None
Hi @neuralsea-lab, thanks for the report!
JSON Forms doesn't handle special characters like / and ~ properly. The ui schema generator needs to improved to detect these characters and encode them to ~1 and ~0 in the scopes respectively. Also our resolving code needs to be adapted to respect these encodings and transform them back. We also need to keep backward compatibility in mind as currently you can just use ~ in JSON Forms without problems.
For now I would like to suggest to transform your data and schema before handing it to JSON Forms (for example by replacing all / in property names with ~) and transforming the outgoing data back to using /. This should be rather straightforward.
ToDo:
- Adapt the ui schema generator, to properly encode the special characters in the
scope. The ui schema generator code is here. - Adapt the resolving code to properly respect encoded values by transforming them back when needed. Maybe it's enough to decode them after this split, but this needs to be checked.
- Add testcases for the ui schema generator and the resolver
Fixed in JSON Forms 3.0 with https://github.com/eclipsesource/jsonforms/pull/1834