| Currently, the JSON format has 2 different representations of step parameters, e.g.:
"steps": [{
"name": "bat",
"arguments": {
"isLiteral": true,
"value": "someBatScript"
}
}]
vs.
"steps": [{
"name": "bat",
"arguments": [{
"key": "script",
"value": {
"isLiteral": true,
"value": "someBatScript"
},
}]
}]
Since JSON is intended only to support tools, this should be consolidated to only use named arguments and the conversion to/from the Jenkinsfile should handle converting to/from these "single required parameter" forms, giving the most idiomatic Jenkinsfile from a JSON representation wherever possible. I think this should be fairly straightforward to implement by checking if the step has a single required parameter, to use that for conversion from a Jenkinsfile and if that is the only parameter supplied by the JSON, convert it back to the idiomatic form. |