Fixed stage schemas
If missing=None, we need to specify allow_None=False in order to generate valid OpenAPI. This may also be fixed by an upstream change in LabThings. Also, OneOf was being used incorrectly in StageTypeProperty.
This commit is contained in:
parent
50ad9d4369
commit
48fa1842a9
2 changed files with 12 additions and 6 deletions
|
|
@ -9,16 +9,19 @@ class MoveStageAPI(ActionView):
|
|||
"absolute": fields.Boolean(
|
||||
missing=False, example=False, description="Move to an absolute position"
|
||||
),
|
||||
"x": fields.Int(missing=None, example=100),
|
||||
"y": fields.Int(missing=None, example=100),
|
||||
"z": fields.Int(missing=None, example=20),
|
||||
"x": fields.Int(missing=None, example=100, allow_none=False),
|
||||
"y": fields.Int(missing=None, example=100, allow_none=False),
|
||||
"z": fields.Int(missing=None, example=20, allow_none=False),
|
||||
}
|
||||
|
||||
def post(self, args):
|
||||
"""
|
||||
Move the microscope stage in x, y, z
|
||||
|
||||
Any axes that are not specifed will not move.
|
||||
This action moves the stage. Any axes that are not specifed will not move.
|
||||
If `absolute=True` is specified, the stage will move to the absolute
|
||||
coordinates given. If not (the default), a relative move is made, i.e.
|
||||
`x=0, y=0, z=0` corresponds to no motion.
|
||||
"""
|
||||
microscope = find_component("org.openflexure.microscope")
|
||||
|
||||
|
|
@ -50,7 +53,8 @@ class ZeroStageAPI(ActionView):
|
|||
def post(self):
|
||||
"""
|
||||
Zero the stage coordinates.
|
||||
Does not move the stage, but rather makes the current position read as [0, 0, 0]
|
||||
|
||||
This action does not move the stage, but rather makes the current position read as [0, 0, 0]
|
||||
"""
|
||||
microscope = find_component("org.openflexure.microscope")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from labthings import fields, find_component
|
||||
from labthings.views import PropertyView
|
||||
from marshmallow import validate
|
||||
|
||||
|
||||
class StageTypeProperty(PropertyView):
|
||||
|
|
@ -8,8 +9,9 @@ class StageTypeProperty(PropertyView):
|
|||
schema = fields.String(
|
||||
missing=None,
|
||||
example="SangaStage",
|
||||
OneOf=["SangaStage", "SangaDeltaStage"],
|
||||
validate=validate.OneOf(["SangaStage", "SangaDeltaStage"]),
|
||||
description="The translation stage geometry",
|
||||
allow_none=False,
|
||||
)
|
||||
|
||||
def get(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue