EccClientGa4ghWesIoForm Component
A proposal (cloud-components#444): the element, its event and the libraries behind it may still change.
Overview
The ecc-client-ga4gh-wes-io-form component renders the input form of a workflow from its GA4GH IO Schema (opens in a new tab) (version 0.3.0, commit 2c3dc49 (opens in a new tab)). It renders the inputs of the schema, validates the values in the browser and emits them; the app submits them, e.g. as workflow_params of a WES run.
- The schema is checked offline against the profile (see I/O Schemas). A schema that doesn't conform shows its errors, with the JSON Pointer of each, and no form.
- Each input gets a control by its
type,formatandenum:
| Input | Control |
|---|---|
string | Text field |
string with format date, time or date-time | Date, time or date-and-time picker |
integer, number | Text field that gives a number |
boolean | Checkbox |
enum or const (any type) | Dropdown |
object with properties | A group with a field per property, at any depth |
array with items | A list with a field per item, "Add" and "Remove" within minItems and maxItems |
Branches of allOf with properties (e.g. nf-core parameter groups) | Sections of the object, with the branch's title and description |
anyOf or oneOf without a type | A choice of the branch (by its title, else its type), then the branch's control |
Anything else (e.g. prefixItems, objects without properties) | JSON text area |
A widget hint (x-ga4gh-ui-widget) chooses the control where it fits its schema, with the keywords it needs next to it, as the profile's UI widgets (opens in a new tab) define:
| Widget | Control |
|---|---|
text, number, checkbox, date-picker, time-picker, datetime-picker | As above |
textarea | Text area |
slider | Slider within the bounds, in steps of multipleOf (else 1 for integers, any step for numbers); an exclusive bound moves one step inward (a thousandth of the range without a step) |
dropdown, radio | Dropdown (radio buttons are rendered as a dropdown for now) |
dropdown or tags on an array with items.enum | Multiple choice |
tags on an array of strings | One tag per line |
typeahead | Text field with the examples as suggestions; with enum, a dropdown |
switch | Checkbox (for now) |
color-picker | Colour picker, giving #rrggbb in lowercase |
File references (x-ga4gh-file, also as a branch of anyOf or oneOf) get a text field for a URI or a relative path. Their values are checked by the profile's rules (see File references) against allowedSchemes, narrowed by the reference's schemes; the checks follow the schema, not the controls, so they also cover branches of anyOf or oneOf that the form doesn't show, items of lists and tags, prefixItems, contains, maps (patternProperties, additionalProperties, unevaluatedProperties), dependentSchemas and both then and else (references by JSON Pointer, $anchor, $dynamicAnchor and $id, also inside embedded resources; $dynamicRef to every schema with its anchor name, and a value behind a reference the checks can't follow is refused). In a union, a string isn't checked as a file reference only if a branch without a file reference surely takes it: every keyword of that branch (also through allOf and $ref) is type, const, enum, pattern, minLength, maxLength or an annotation, and the string passes them. File reference text is kept as entered, so surrounding spaces make it invalid. Values nested more than 64 levels deep are refused. Refused values make the form invalid, and refused defaults aren't prefilled. A picker for DRS or storage is up to the app for now.
A widget that doesn't fit, a viewer, or a custom: widget renders the input by its type. Inputs whose type allows null get a "No value (null)" checkbox, which disables the control while it is checked. Required inputs are marked with * (also when an allOf branch requires them). Inputs with more than 1000 properties, and lists with more than 1000 items, are edited as JSON.
3. Inputs start from their default values (a union without one from the default of its first branch); inputs the user clears are left out of the values, not sent as null or "". A schema's own default is kept as it is, also "" or null.
4. Errors show at their input once it was changed, and at all inputs after reportValidity().
5. A schema's x-ga4gh-error-message replaces the validator's messages for failures at its value, once per value; of several, the outermost wins (the input's own over that of a shared definition it refers to). Failures of a property's value use the property's message; a missing property uses the message of its object.
6. Inputs with x-ga4gh-hidden: true are listed under a collapsed "Advanced" section, except inputs that must be set (required, without a default) and inputs whose values fail.
Values follow the profile's widget table: a time is an RFC 3339 full-time with the offset of the browser's time zone (14:30:00+01:00), a date-time is in UTC (2026-12-14T09:15:00Z). Text that isn't a number is kept, so that the error says what is wrong.
Security
Schemas are treated as untrusted: titles, descriptions and choices are shown as text, never as markup. Descriptions with x-ga4gh-description-format: markdown are shown as plain text unless the app switches Markdown on (see Descriptions).
Usage
The preview renders example schemas of the IO Schema profile and shows what the form emits.
Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
schema | object | undefined | The IO schema of the workflow. | |
values | object | undefined | Values to start from instead of the defaults. | |
allowedSchemes | allowed-schemes | string[] | ["drs", "https"] | URI schemes that file references and links in descriptions may have; the attribute takes them separated by spaces or commas, in any case. Changing it checks the values again (defaults refused at load stay out). |
inputValues | object | The current values (read only, a copy). |
Methods
| Method | Description |
|---|---|
reportValidity() | Shows the errors of all inputs and returns whether the values are valid. |
Events
| Event | Detail | Description |
|---|---|---|
ecc-io-form-changed | { values, valid, errors } | When the schema is loaded and whenever a value changes. errors holds { pointer, message }, with JSON Pointers into values. |
CSS Parts
| Part | Description |
|---|---|
base | The form. |
