Skip to content

Empty device enums #1123

@callumforrester

Description

@callumforrester

Blueapi's API provides JSON schemas for plan parameters. As of #526 it includes enums for devices that relate to the loaded context, for example if I have the following plan:

def take_data(detector: Readable) -> MsgGenerator[None]: ...

and 2 devices in my context that are Readable, then the JSON schema will be an enum of those 2:

{ "take_data": {
    "additionalProperties": false,
    "description": "",
    "properties": {
      "detector": {
        "description": "",
        "enum": ["det1", "det2"],
        "title": "Detector",
        "type": "bluesky.protocols.Readable"
      },
  }
}

However if there are no readables configured on my server then the schema will be:

{ "take_data": {
    "additionalProperties": false,
    "description": "",
    "properties": {
      "detector": {
        "description": "",
-        "enum": ["det1", "det2"],
+        "enum": [],
        "title": "Detector",
        "type": "bluesky.protocols.Readable"
      },
  }
}

This schema is unsatisfiable, there is no value that will ever satisfy it and so the plan can never run.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Load the above plan into blueapi and no devices
  2. Run blueapi controller plans -o json

Acceptance Criteria

  • Unsatisfiable plans are not loaded into context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjson formsTickets involved in producing a JSONForms UI from the plan schemas

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions