Validate scan shape on the server
The scan API view now uses a schema with validation constraints to enforce a minimum size of 1 in any dimension. This requires better error handling in the app, which I've added. It also needs a fix in LabThings so the error propagates correctly
This commit is contained in:
parent
df5d0dab68
commit
792e782968
2 changed files with 16 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ import datetime
|
|||
import logging
|
||||
import time
|
||||
import uuid
|
||||
import marshmallow
|
||||
from functools import reduce
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
|
|
@ -361,7 +362,7 @@ class ScanExtension(BaseExtension):
|
|||
|
||||
class TileScanArgs(FullCaptureArgs):
|
||||
namemode = fields.String(missing="coordinates", example="coordinates")
|
||||
grid = fields.List(fields.Integer, missing=[3, 3, 3], example=[3, 3, 3])
|
||||
grid = fields.List(fields.Integer(validate=marshmallow.validate.Range(min=1)), missing=[3, 3, 3], example=[3, 3, 3], )
|
||||
style = fields.String(missing="raster")
|
||||
autofocus_dz = fields.Integer(missing=50)
|
||||
fast_autofocus = fields.Boolean(missing=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue