How escape special characters in ui schema element's scope

I found one of the schemas having this:

"herbicide_concentration_\\%":{
                "type":"number",
                "title":"Herbicide Concentration %"
},

JSON’s keys supports \\ and /to escape special characters. Due to this, the ui schema element should be like this:

{
    "type": "Control",
    "scope": "#/properties/herbicide_concentration_\\%",
    "label": "Herbicide Concentration %"
}

This generates a malformed decodeURI input in jsonforms-core.cjs.js. On the other hand, if I use / to escape it can’t find property %, because takes ‘%’ as property name.

{
    "type": "Control",
    "scope": "#/properties/herbicide_concentration_/%",
    "label": "Herbicide Concentration %"
}

Is there a way to have special characters in element’s scope path? Thank’s in advance!

Hello @leo ,
AFAIK, there is no support for the escape characters you mentioned.
However, you mentioned that trying to escape the special characters resulted in malformed decodeURI input.
Did you try to URI encode your scope segments?
For this, you could use the JavaScript method encodeURI, e.g.
encodeURI('#/properties/herbicide_concentration_%') results in '#/properties/herbicide_concentration_%25'
Kind regards,
Lucas

Thanks for the response Lucas! I added the encodeURI and but ended up in a No applicable renderer found. error. Seems like it’s not supported.

Thanks again!

Hi @leo,

Thanks for the report. In my eyes this seems to be a bug. Actually I don’t know why we even call decodeURIComponent there.

@lucas-koehler I think we can just remove this call there, I don’t think we need it. Do you agree?

@leo Can you open an issue against the JSON Forms repo?

@sdirix Yes, I agree. While a possibility to escape characters is certainly useful, this should be done in a proper way and then also be documented to make it clear to adopters which approach they can use.

Hi Stefan!

Sure! Thanks for your support @lucas-koehler and @sdirix