Skip to content

Let uploaded and in-browser scripts declare a parameters schema #94

Description

@bburda

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions