DiamondLightSource / DiamondLightSource/blueapi

Device types in JSON schemas are non-standard

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

Description

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

```json
{
"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 https://github.com/DiamondLightSource/blueapi/pull/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

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.