DiamondLightSource / DiamondLightSource/blueapi

Enumerate nested devices in plan schemas

Open
#1,129 1 comment 0 reactions 0 assignees View on GitHub
c: rest api c: ui decision pending enhancement
Dominant language
Python
Stars
13
Forks
13
Avg merge
2d 11h
Merged PRs (30d)
25

Description

Following #526 plan schemas include enums of all possible devices that can be supplied, for example:

```json
{
"bump_motor": {
"additionalProperties": false,
"description": "",
"properties": {
"motor": {
"description": "",
"enum": [
"x",
"y"
],
"title": "Motor",
"type": "bluesky.protocols.Movable"
}
}
}
}
```

However, if devices are nested they are not picked up by this process, so if I have

```python
class SimStage(StandardReadable):
def __init__(self, name: str = "") -> None:
with self.add_children_as_readables():
self.x = Motor("BAZ:")
self.y = Motor("BLARG:")
super().__init__(name)
```

It does not appear, I would expect something like

```json
{
"bump_motor": {
"additionalProperties": false,
"description": "",
"properties": {
"motor": {
"description": "",
"enum": [
"sim_stage.x",
"sim_stage.y"
],
"title": "Motor",
"type": "bluesky.protocols.Movable"
}
}
}
}
```

I have created a failing test in https://github.com/DiamondLightSource/blueapi/pull/1127

## Acceptance Criteria
- Nested devices are included in enums
- Failing test linked above passes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.