diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py
index 125f54e7373..e73c34a8e3f 100755
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -803,7 +803,8 @@ class Tool(Dictifiable):
name = inputs_elem.get("name")
filename = inputs_elem.get("filename", None)
format = inputs_elem.get("format", "json")
- content = dict(format=format)
+ data_style = inputs_elem.get("data_style", "skip")
+ content = dict(format=format, handle_files=data_style)
self.config_files.append((name, filename, content))
for conf_elem in conf_parent_elem.findall("configfile"):
name = conf_elem.get("name")
diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py
index 25f5804a50b..0e8dbee6735 100644
--- a/lib/galaxy/tools/evaluation.py
+++ b/lib/galaxy/tools/evaluation.py
@@ -561,12 +561,13 @@ class ToolEvaluator(object):
return content, True
content_format = content["format"]
+ handle_files = content["handle_files"]
if content_format != "json":
template = "Galaxy can only currently convert inputs to json, format [%s] is unhandled"
message = template % content_format
raise Exception(message)
- return json.dumps(wrapped_json.json_wrap(self.tool.inputs, self.param_dict)), False
+ return json.dumps(wrapped_json.json_wrap(self.tool.inputs, self.param_dict, handle_files=handle_files)), False
def __write_workdir_file(self, config_filename, content, context, is_template=True):
if is_template:
diff --git a/lib/galaxy/tools/parameters/wrapped_json.py b/lib/galaxy/tools/parameters/wrapped_json.py
index b5b4989776a..9eb8e2716b0 100644
--- a/lib/galaxy/tools/parameters/wrapped_json.py
+++ b/lib/galaxy/tools/parameters/wrapped_json.py
@@ -5,7 +5,7 @@ log = logging.getLogger(__name__)
SKIP_INPUT = object()
-def json_wrap(inputs, input_values, as_dict=None, handle_files="SKIP"):
+def json_wrap(inputs, input_values, as_dict=None, handle_files="skip"):
if as_dict is None:
as_dict = {}
@@ -19,8 +19,15 @@ def json_wrap(inputs, input_values, as_dict=None, handle_files="SKIP"):
return as_dict
-def _json_wrap_input(input, value, handle_files="SKIP"):
+def _json_wrap_input(input, value, handle_files="skip"):
input_type = input.type
+
+ def _data_input_to_path(v):
+ path = _cast_if_not_none(v, str)
+ if path == "None":
+ path = None
+ return path
+
if input_type == "repeat":
repeat_job_value = []
for d in value:
@@ -44,15 +51,21 @@ def _json_wrap_input(input, value, handle_files="SKIP"):
json_wrap(input.inputs, values, section_job_value)
json_value = section_job_value
elif input_type == "data" and input.multiple:
- if handle_files == "SKIP":
+ if handle_files == "paths":
+ json_value = list(map(_data_input_to_path, value))
+ elif handle_files == "skip":
return SKIP_INPUT
- raise NotImplementedError()
+ else:
+ raise NotImplementedError()
elif input_type == "data":
- if handle_files == "SKIP":
+ if handle_files == "paths":
+ json_value = _data_input_to_path(value)
+ elif handle_files == "skip":
return SKIP_INPUT
- raise NotImplementedError()
+ else:
+ raise NotImplementedError()
elif input_type == "data_collection":
- if handle_files == "SKIP":
+ if handle_files == "skip":
return SKIP_INPUT
raise NotImplementedError()
elif input_type in ["select", "text", "color", "hidden"]:
diff --git a/lib/galaxy/tools/xsd/galaxy.xsd b/lib/galaxy/tools/xsd/galaxy.xsd
index 582172f6ad7..da544f3a7b1 100644
--- a/lib/galaxy/tools/xsd/galaxy.xsd
+++ b/lib/galaxy/tools/xsd/galaxy.xsd
@@ -4549,7 +4549,7 @@ the path to the file created with this directive.
tag set. It tells Galaxy to
-write out a JSON representation of the tool parameters .
+write out a JSON representation of the tool parameters.
*Example*
@@ -4573,6 +4573,9 @@ the specified name (i.e. ``inputs.json``).
A contrived example of a tool that uses this is the test tool
[inputs_as_json.xml](https://github.com/galaxyproject/galaxy/blob/dev/test/functional/tools/inputs_as_json.xml).
+
+By default this file will not contain paths for data or collection inputs. To include simple
+paths for data parameters set the ``data_style`` attribute to ``paths`` (see [inputs_as_json_with_paths.xml](https://github.com/galaxyproject/galaxy/blob/dev/test/functional/tools/inputs_as_json_with_paths.xml) for an example).
]]>
@@ -4590,6 +4593,11 @@ response to this directive.
Path relative to the working directory of the tool for the inputs JSON file created in response to this directive.
+
+
+ Set to 'paths' to include dataset paths in the resulting file.
+
+
diff --git a/test/functional/tools/inputs_as_json_with_paths.xml b/test/functional/tools/inputs_as_json_with_paths.xml
new file mode 100644
index 00000000000..2b301708868
--- /dev/null
+++ b/test/functional/tools/inputs_as_json_with_paths.xml
@@ -0,0 +1,134 @@
+
+
+ python '$check_inputs' '$inputs' $test_case
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test tool demonstrating the special inputs config file.
+
+
diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml
index a5a8e5a13b0..c88a2f67ce0 100644
--- a/test/functional/tools/samples_tool_conf.xml
+++ b/test/functional/tools/samples_tool_conf.xml
@@ -29,6 +29,7 @@
+