Story #9031
closed
[SDKs] arv-run-pipeline-instance accepts json objects/arrays as script parameter values
Added by Tom Clegg over 8 years ago.
Updated almost 5 years ago.
Description
Currently it is impossible to pass a JSON object as a script parameter. For example,
arv-run-pipeline-instance 'foo::input={"foo":"bar"}'
results in
"script_parameters":{
"input":"{\"foo\":\"bar\"}
}
- Description updated (diff)
- Tracker changed from Bug to Story
- Subject changed from arv-run-pipeline-instance should accept json objects/arrays as script parameter values to [SDKs] arv-run-pipeline-instance accepts json objects/arrays as script parameter values
Tom, since you pointed this, is there a particular fix you had in mind?
Note that at least one pipeline author has written Crunch scripts that expect exactly these "JSON strings" and reads them in with json.loads()
. Part of the reason for that is Workbench doesn't have any support for input arrays or objects either, so letting pipeline users simply write the JSON by hand in a string is actually the most straightforward solution right now.
Proposed implementation: if your input starts with ", [, or {, it's assumed to be JSON, parsed as such, and then the resulting value is stored as the value of the corresponding parameter.
This potentially breaks compatibility for existing callers of a-r-p-i, but we think we can live with it since it's easy enough to work around: just double-quote (and potentially escape) your string.
Why not add in a flag so old behavior stays the same while still giving the user the option for more complex parameter passing? Something like:
arv-run-pipeline-instance --json-param 'foo::input={"foo":"bar"}'
...or even
arv-run-pipeline-instance --param 'foo::input={"foo":"bar"}'
?
- Status changed from New to Closed
Also available in: Atom
PDF