Summary
A script defined in the gateway's manifest can carry a parameters_schema, and the Scripts tab turns it into a form: one labelled field per parameter, with types. A script uploaded from a file or written in the browser never can, so its author always gets the raw JSON textarea instead - even though they are the person most likely to know what the parameters are, having just written them.
The gap is only in the interface. The upload endpoint takes a metadata part that already accepts parameters_schema alongside name and description, and the dialog simply does not offer a way to fill it in.
Proposed solution (optional)
Add a schema field to the upload dialog, in both the file and the write mode, and include it in the metadata part when it is filled in. The rest of the path already works: the gateway stores it, the list returns it, and the row renders a form whenever the schema converts into one.
Two details worth deciding while implementing:
- what to do with a schema that is syntactically valid JSON but does not describe an object with properties. The row already falls back to the raw JSON editor in that case, so the dialog could accept it and let the fallback happen, or reject it at entry with an inline error.
- whether the write mode should offer a starter schema next to the starter script template, since the two go together.
Additional context (optional)
Came out of the Scripts tab work in #90, which added writing a script directly in the browser and made this asymmetry visible: you can now author a script without leaving the app, but not describe its parameters.
Summary
A script defined in the gateway's manifest can carry a
parameters_schema, and the Scripts tab turns it into a form: one labelled field per parameter, with types. A script uploaded from a file or written in the browser never can, so its author always gets the raw JSON textarea instead - even though they are the person most likely to know what the parameters are, having just written them.The gap is only in the interface. The upload endpoint takes a
metadatapart that already acceptsparameters_schemaalongsidenameanddescription, and the dialog simply does not offer a way to fill it in.Proposed solution (optional)
Add a schema field to the upload dialog, in both the file and the write mode, and include it in the
metadatapart when it is filled in. The rest of the path already works: the gateway stores it, the list returns it, and the row renders a form whenever the schema converts into one.Two details worth deciding while implementing:
Additional context (optional)
Came out of the Scripts tab work in #90, which added writing a script directly in the browser and made this asymmetry visible: you can now author a script without leaving the app, but not describe its parameters.