YAML_SCHEMA_ISSUE

YAML tool parameter schema leaks XML-only metamodel fields

Summary

UserToolSource and AdminToolSource (in lib/galaxy/tool_util_models/__init__.py) declare inputs: List[GalaxyToolParameterModel], which is a discriminated union over the full internal Galaxy XML parameter metamodel. As a result the YAML tool authoring surface — and the published JSON schema driving the Monaco editor — advertises fields and whole parameter types that XML tools use but that YAML tools either ignore or cannot implement.

This is both a user-facing UX problem (bogus autocomplete, bogus validation passes) and a commitment problem (shipping a schema we will want to shrink later).

Evidence

UserToolSource.inputs uses GalaxyToolParameterModel (lib/galaxy/tool_util_models/parameters.py:2372), a RootModel over GalaxyParameterT — the same union used internally for XML-parsed tools. The client consumes it via client/src/components/Tool/ToolSourceSchema.json, regenerated from UserToolSource.model_json_schema() (client/src/components/Tool/rebuild.py).

Dumping properties from that published schema:

BooleanParameterModel      -> name, parameter_type, hidden, label, help, argument,
                              is_dynamic, optional, type, value, truevalue, falsevalue
HiddenParameterModel       -> ..., value, validators
DataColumnParameterModel   -> ..., multiple, value    # note: no data_ref
GenomeBuildParameterModel  -> ..., multiple
DrillDownParameterModel    -> ..., options, multiple, hierarchy
BaseUrlParameterModel      -> (only base fields)
GroupTagParameterModel     -> ..., multiple
RulesParameterModel        -> (only base fields)
DirectoryUriParameterModel -> ..., validators

Nonsensical field leaks on otherwise-supported types

Whole parameter types that don’t work from YAML

Validators carried along wholesale

TextCompatiableValidators (Length / Regex / Expression / EmptyField) and SelectCompatiableValidators (NoOptions) are reused from the XML world. Length / Regex / NoOptions / EmptyField are fine. ExpressionParameterValidatorModel is a Cheetah-style expression validator and does not belong in a sandboxed-YAML world.

Partial prior narrowing

Some XML attributes are already absent from these models — e.g. display on select, data_ref on data_column, dynamic_options, code_file, refresh_on_change, sanitizer. So the intent to narrow exists; it just hasn’t been completed, and it’s been done by omission rather than by an explicit narrower base class.

Why it matters

  1. API surface commitment. The PR 19434 TODO explicitly plans to publish the UserToolSource schema. Every dead field becomes a thing users will try to set, file bugs about, and that is painful to remove later.
  2. Editor UX. Monaco autocompletes truevalue, hidden, argument, is_dynamic, and whole parameter types that cannot work, implying they mean something.
  3. Runtime divergence. runtimeify only implements DataParameterModel adaptation. Several parameter types in the advertised union fall through unchanged or raise NotImplementedError. The type system promises support the runtime doesn’t deliver.
  4. Maintenance drag. Every new XML metamodel field silently leaks into user-defined tools.

Scope of affected sources

What this issue does not touch

Goal

Introduce an explicit, narrower YAML-facing parameter model used by UserToolSource and AdminToolSource, with a one-way mapping into the existing internal metamodel so no downstream code changes shape. The published ToolSourceSchema.json shrinks accordingly, and extra="forbid" on the new models prevents future accidental leaks.