Skip to content

Device types in JSON schemas are non-standard #1121

Open

Description

@callumforrester

See the following example JSON snippet from the /plans endpoint:

{
  "name": "count",
  "description": "Reads from a number of devices.\n    Wraps bluesky.plans.count(det, num, delay, md=metadata) exposing only serializable\n    parameters and metadata.",
  "parameter_schema": {
    "additionalProperties": false,
    "properties": {
      "detectors": {
        "items": {
          "enum": [
            "sample_stage",
            "sample_det",
            "oav",
            "synchrotron",
            "panda"
          ],
          "type": "bluesky.protocols.Readable"
        },
        "title": "Detectors",
        "type": "array",
        "uniqueItems": true
      },
...

The detector type is listed as "bluesky.protocols.Readable", JSONForms does not seem to be compatible with arbitrary types in this way. See the following error:

Uncaught Error: schema is invalid: data/properties/detectors/items/type must be equal to one of the allowed values, data/properties/detectors/items/type must be array, data/properties/detectors/items/type must match a schema in anyOf, data/properties/detectors/items must be array, data/properties/detectors/items must match a schema in anyOf

When I change the type to "string" I get a form rendered.

@tpoliaw suggested moving the bluesky type to a non-standard field in #522, which may be a good idea given that the current state of affairs requires special casing in any clients.

Acceptance Criteria

  • Clients reading plan schemas do not need insider knowledge to determine device parameter types

Activity

  1. added
    c: rest api
    c: ui
    on Jul 11, 2025
  2. callumforrester commented on Jul 22, 2025

    @callumforrester
    ContributorAuthor

    JW: Remove the type field that is returned - the enum already defines what the allowable values are, for now we aren't doing any validation or special handling. We may want to return a type when we have special UI elements, but for now having an unused field that may change is worse than having no field.

  3. added this to the Blueapi 2.0.0 milestone on Dec 5, 2025
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

    c: rest apic: ui

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions