On the conditionals schema dependencies, how can I achieve having the conditional schema be displayed if corresponding enum array "contains" a value. Right now, it seems its only doing equality check and not supporting wildcards "*" etc.
For eg, in the schema, I have this property
"usageOptions": {
"type": "array",
"title": "Loan Usage Options",
"items": {
"type": "string",
"enum": [
"Other Home Addresses",
"Refinance",
"Home Improvement",
"Education",
"Other"
]
},
"uniqueItems": true
},
And the conditional dependencies schema as
"dependencies": {
"usageOptions": {
"oneOf": [
{
"properties": {
"usageOptions": {
"items": {
"enum": [
"Other"
]
}
},
"othersDes": {
"type": "string",
"title": "Please describe others"
}
}
}
]
}
}
I want othersDes text field to appear when selected enum values "contains" Other option. So, in the multiple select list, no matter what user selects, if Other is part of selection, then, othersDes text field should display.
The othersDes text field is appearing when only Other is selected.
latest version "^1.2.0"
You can use the pattern attribute to filter by a regular expression, such as other*. In this case, pattern: "Other" will suffice to make sure that the field contains the word "other." Playground link
Thanks @epicfaace , but this is showing the conditional schema when ONLY item containing 'Other' text is selected. I want to show the conditional schema even when multiple options are selected and one of the selected options is enum value Other.

For example, in above scenario, it should show the conditional schema 'please describe others' text field.
You can use the contains keyword for this: playground link
Thank you so much @epicfaace . I used a combination of your suggestions to solve, and works like a charm. Here is how the dependency looks like, for anyone else facing this issue
dependencies: {
usageOptions: {
oneOf: [
{
properties: {
usageOptions: {
contains: {
enum: ["Other"]
}
},
othersDes: {
type: "string",
title: "Please describe others"
}
}
}
]
}
}
This will make sure that conditional schema kicks in only when specifically, one if the enum options ( in this case Other is included the enum array.
Great, glad it works @KKS1 !
Most helpful comment
You can use the
containskeyword for this: playground link