-
Notifications
You must be signed in to change notification settings - Fork 419
Description
Describe the bug
Consider the following schema:
{
"type": "object",
"unevaluatedProperties": false,
"properties": {
"/work/email": {
"title": "Email with slash",
"description": "Email address With Slash",
"type": "string",
"format": "email"
}
},
"required": [
"/work/email"
],
}
Since the path(/work/email) contains a forward slash, the final encoded scope looks a bit different (forward slashes get converted to ~1). When trying to check if the field is required, the most direct path is to use the required prop inside the control from mapStateToControlProps. However, since the path doesn't get decoded, it doesn't match with what is inside the global required.
Expected behavior
The scope path should be decoded and then matched against the required field
Steps to reproduce the issue
- Use the above schema
- Use any renderer which matches the above sub-schema and is using the
control.requiredto show an asterisk for example - Notice that the asterisk won't show up
Screenshots
No response
Which Version of JSON Forms are you using?
v3.3.0
Framework
Core
RendererSet
No response
Additional context
I believe I know where to implement a fix and can even create a PR to help do this.
In the isRequired function in the src/util/renderers.ts file, the decode needs to get imported and then used on the lastSegment before isRequired returns