Marshmallow hardware props are never required?
I would like to know if it's normal to have no required props in the in the hardware Properties
?
Is that part of the behaviour of the server? Or could we reduce the amount of optional stuffs?
Because on the client side i have handled it in the exact reverse. A motor have to have a position and a unit, else it's not a motor. I would like to confirm we can do
class MotorPropertiesSchema(HardwareSchema):
position = fields.Float(required=True)
target = fields.Float(required=True)
tolerance = fields.Float(required=True)
acceleration = fields.Float(required=True)
velocity = fields.Float(required=True)
limits = fields.List(fields.Float(), required=True, metadata={"length": 2})
state = fields.List(
fields.Str(metadata={"enum": MotorStates}), required=True, metadata={"readOnly": True}
)
unit = fields.Str(required=True, metadata={"readOnly": True})
offset = fields.Float(required=True)
sign = fields.Int(required=True)
(BTW acceleration
and velocity
can be null i think -> allow_none=True
)
If that's not the case, there is still probably some required
to put in the nested structures of MultipositionPropertiesSchema
Any idea @sfisher?
Edited by Valentin Valls