I could get the nearest to this by using Extended Choice Parameter > JSON Parameter Type > JSON Parameter Config Groovy Script.
import org.boon.Boon;
def jsonEditorOptions = Boon.fromJson(/{
disable_edit_json: true,
disable_properties: true,
no_additional_properties: true,
disable_collapse: true,
disable_array_add: false,
disable_array_delete: false,
disable_array_reorder: false,
theme: "bootstrap3",
iconlib: "fontawesome5",
schema: {
"type": "object",
"title": "",
"required": [
"Locations"
],
"properties": {
"Locations": {
"type": "array",
"format": "table",
"title": "",
"uniqueItems": true,
"items": {
"type": "object",
"title": "Location",
"properties": {
"Country": {
"type": "string",
"propertyOrder" : 1,
"enum": [
"USA",
"Germany",
"India"
]
},
"City": {
"type": "string",
"propertyOrder" : 2,
"enum": [
"New York",
"Frankfurt",
"Mumbai"
]
},
"Neighborhood": {
"type": "string",
"propertyOrder" : 3
}
}
},
"default": [{
"Country": "USA",
"City": "New York",
"Neighborhood": "Times Square"
}]
}
}
}
/);
You can visit the plugin page and json-editor.github.io to create and validate your
JSON schemas as seen above.
This is how it appears in Jenkins:
Note that however, it still does not provide a context sensitive
second column based on what is selected in the first column. The
second column rather behaves exactly like the first column where you
select from a pre-defined list without any filters.
On printing the variable Location
, it returns this JSON:
{"Locations":[{"City":"New York","Country":"USA","Neighborhood":"Times Square"},{"City":"Frankfurt","Country":"Germany","Neighborhood":"Bornheim"},{"City":"Mumbai","Country":"India","Neighborhood":"Vile Parle"}]}