Repository navigation
ADD: publish a number's min, max and step so a tool can ask for a slider - #105
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A tool can now ask for a slider on a number, and the server carries its bounds to the clients.
What changes
ArgSpecgainsmin,maxandstep, read from the tool's schema (_ARGUMENT_KEYSand_PRESENTATION_KEYSname them, as the module requires of every key).GET /toolspublishes them only where a tool declared them, so the published shape of every other tool is unchanged byte for byte (the golden fixture is untouched).ui: "slider"becomes a legal layout for anintor afloat.check_schemarefuses at boot what a client could not honour: a slider without both bounds,minnot belowmax, a non-positivestep, a non-number, bounds on a text or choice argument, and fractional bounds on anint.They are presentation only, like
sectionorui:validate()ignores them and the tool's own check is what refuses a value. That keeps a direct API call exactly as before.Why
The clients already draw
ui: "slider"withmin/max/step(the Slicer form generator does), but nothing published the bounds, so a tool could not ask for one. TMJ_Crop's crop size is the first user (SADT-VISOR and the Slicer extension have matching PRs). Until this is deployed, an older server drops the keys and the panel shows a plain number field.Tests
server/tests/test_schema_registry.py: the bounds reach the spec, they reach the wire only where declared, and each refused case. The full suite passes excepttest_dev_mounts, which fails identically onupstream/mainhere, and one run oftest_nested_admissionthat failed once in the full suite and passed on rerun.