labthings / labthings/labthings-fastapi
Add a way to select `Thing`s from a `thing_slot`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
The new thing_slot introduced in #194 should be ideal for plugins: by declaring a mapping slot with the right type, a Thing can access all instances of PluginThing on the server.
It's common to want to choose a plugin - e.g. set the current method used for background detection or scan planning in an OFM. Currently, this can be done with a string - but it would be lovely to have the available Thing names appear as enum options, so that UI code can automatically generate a drop-down selector.
This is not possible at the moment, because the TD is generated from static types, and said static types don't know what Things are available in the server.
I propose we allow the model (but not the value_type) of properties to depend on the host Thing. Doing so means that we could declare the property as a string, but include it in the TD as an enum. We could do run-time validation of the string, but by restricting it to the correct values in the schema, we make it much easier to generate a nice UI.
This is unlikely to make it for the next release, but maybe the next one...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the thing_slot implementation introduced in #194 and the code that generates the TD from static types. Trace how a host Thing could supply available Thing names to the property model without changing value_type. Done means the TD exposes those names as enum options and runtime validation remains limited to valid selections.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100