Skip to content

feat: Enumerate devices in plan schemas#526

Merged
tpoliaw merged 2 commits intomainfrom
reference_schema
Jun 25, 2025
Merged

feat: Enumerate devices in plan schemas#526
tpoliaw merged 2 commits intomainfrom
reference_schema

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Jun 25, 2024

When a plan is expecting a device name, there is a limited number of
valid devices available to choose from. Making these available in the
schema allows clients to restrict input to valid options only.

Addresses #518

@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jun 25, 2024

Example schema (for set_relative)

{
    'additionalProperties': False,
     'properties': {'group': {'title': 'Group',
                              'type': 'string'},
                    'movable': {'enum': ['sample_pressure',
                                         'x_err',
                                         'theta',
                                         'z',
                                         'y',
                                         'x',
                                         'sample_temperature'],
                                'target_type': 'bluesky.protocols.Movable',
                                'title': 'Movable',
                                'type': 'string'},
                    'value': {'title': 'Value'},
                    'wait': {'title': 'Wait',
                             'type': 'boolean'}},
     'required': ['movable'],
     'title': 'set_relative',
     'type': 'object'}
}

@codecov
Copy link

codecov bot commented Jun 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.05%. Comparing base (91d7117) to head (15ac4fd).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #526   +/-   ##
=======================================
  Coverage   95.05%   95.05%           
=======================================
  Files          41       41           
  Lines        2528     2529    +1     
=======================================
+ Hits         2403     2404    +1     
  Misses        125      125           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@keithralphs
Copy link
Contributor

Example schema (for set_relative)

{
    'additionalProperties': False,
     'properties': {'group': {'title': 'Group',
                              'type': 'string'},
                    'movable': {'enum': ['sample_pressure',
                                         'x_err',
                                         'theta',
                                         'z',
                                         'y',
                                         'x',
                                         'sample_temperature'],
                                'target_type': 'bluesky.protocols.Movable',
                                'title': 'Movable',
                                'type': 'string'},
                    'value': {'title': 'Value'},
                    'wait': {'title': 'Wait',
                             'type': 'boolean'}},
     'required': ['movable'],
     'title': 'set_relative',
     'type': 'object'}
}

This seems to have an extra curly bracket in it (according to JSON validation) , typo maybe?, also shouldn't the False in additional properties be false? Apart from them it seems to render correctly in the browser via JSON when these are corrected.

@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jun 26, 2024

Copy/paste/reformat error on my part I think copying from the output. Is the json returned in the response correct? And yes, I copied it from the test which uses Python

@keithralphs
Copy link
Contributor

Copy/paste/reformat error on my part I think copying from the output. Is the json returned in the response correct? And yes, I copied it from the test which uses Python

Haven't tried it dynamically yet, just copy/pasted it myself, corrected the errors and checked :). I'll run it up later and test it live.

@tpoliaw tpoliaw changed the title Enumerate devices in plan schemas feat: Enumerate devices in plan schemas Jun 20, 2025
@tpoliaw tpoliaw force-pushed the reference_schema branch from 493af11 to 4898cda Compare June 23, 2025 08:15
@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jun 23, 2025

Copying the output into jsonforms appears to show the drop-down as expected

tpoliaw added 2 commits June 25, 2025 10:13
When a plan is expecting a device name, there is a limited number of
valid devices available to choose from. Making these available in the
schema allows clients to restrict input to valid options only.
@tpoliaw tpoliaw merged commit 65ca166 into main Jun 25, 2025
19 checks passed
@tpoliaw tpoliaw deleted the reference_schema branch June 25, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants