Start explicit metadata argument for marshmallow

A side effect of re-locking dependencies is having a newer marshmallow.
This deprecates having `description=` as a keyword, and puts it in a
separate metadata arg instead.

This commit is the start of my search-and-replaceing to update to the new
format.
This commit is contained in:
Richard Bowman 2022-08-09 12:52:57 +01:00
parent 78ef9c531b
commit e22f36b308
14 changed files with 58 additions and 58 deletions

View file

@ -15,18 +15,18 @@ class CaptureResizeSchema(Schema):
class BasicCaptureArgs(Schema):
use_video_port = fields.Boolean(missing=False)
use_video_port = fields.Boolean(load_default=False)
bayer = fields.Boolean(
missing=False, description="Include raw bayer data in capture"
load_default=False, metadata={"description": "Include raw bayer data in capture"}
)
resize = fields.Nested(CaptureResizeSchema(), required=False)
class FullCaptureArgs(BasicCaptureArgs):
filename = fields.String(example="MyFileName")
temporary = fields.Boolean(missing=False, description="Delete capture on shutdown")
annotations = fields.Dict(missing={}, example={"Client": "SwaggerUI"})
tags = fields.List(fields.String, missing=[], example=["docs"])
temporary = fields.Boolean(load_default=False, metadata={"description": "Delete capture on shutdown"})
annotations = fields.Dict(load_default={}, example={"Client": "SwaggerUI"})
tags = fields.List(fields.String, load_default=[], example=["docs"])
class CaptureAPI(ActionView):
@ -113,7 +113,7 @@ class GPUPreviewStartAPI(ActionView):
in the format ``[x, y, width, height]``.
"""
args = {"window": fields.List(fields.Integer, missing=[], example=[0, 0, 640, 480])}
args = {"window": fields.List(fields.Integer, load_default=[], example=[0, 0, 640, 480])}
def post(self, args):
"""

View file

@ -7,11 +7,11 @@ from labthings.views import ActionView
class MoveStageAPI(ActionView):
args = {
"absolute": fields.Boolean(
missing=False, example=False, description="Move to an absolute position"
load_default=False, example=False, metadata={"description": "Move to an absolute position"}
),
"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),
"x": fields.Int(load_default=None, example=100, allow_none=False),
"y": fields.Int(load_default=None, example=100, allow_none=False),
"z": fields.Int(load_default=None, example=20, allow_none=False),
}
def post(self, args):

View file

@ -59,7 +59,7 @@ class CaptureSchema(ImageSchema):
# without the server having to do a tonne of file IO
dataset = fields.Nested(BasicDatasetSchema())
file = fields.String(
data_key="path", description="Path of file on microscope device"
data_key="path", metadata={"description": "Path of file on microscope device"}
)
# No need to make a schema for links as we only ever
# create the dictionary right here in `generate_links`

View file

@ -7,10 +7,10 @@ class StageTypeProperty(PropertyView):
"""The type of the stage"""
schema = fields.String(
missing=None,
load_default=None,
example="SangaStage",
validate=validate.OneOf(["SangaStage", "SangaDeltaStage"]),
description="The translation stage geometry",
metadata={"description": "The translation stage geometry"},
allow_none=False,
)