electric icon indicating copy to clipboard operation
electric copied to clipboard

validate acceptable values during RESTful writes strictly

Open johncclayton opened this issue 9 years ago • 3 comments

johncclayton avatar Jan 07 '17 09:01 johncclayton

provide the following:

  • meta data based validation that can provide front-ends with hints about type, min, max, enum values for every field, available on a per RESTful object basis via <URI>/meta
  • type/range/enum validation on all write requests into the server - with appropriate error codes and messages if validation fails
  • unit tests for the above
  • investigate using the Flask-RESTful Fields system to marshall instead of to_dict() as I've got it now.

AC:

  • a clean method to translate between modbus required types and tuple lists and the python instances
  • meta data descriptions of fields, this includes their type, max/min, enum values, max length, name and description

In the end: don't allow out of range values to be applied to any field whatsoever, while I'm sure the charger manufacturer has done a huge amount of testing - I don't want this product to be responsible for starting fires due to an invalid data entry on PUT/PATCH/POST.

johncclayton avatar Jan 07 '17 09:01 johncclayton

https://schematics.readthedocs.io/en/latest/index.html

johncclayton avatar Jan 07 '17 13:01 johncclayton

We don't care - however; when we go public we will want to copy the range validations from the client into the preset model and activate POST/PUT validate calls on the RESTful interface. The client will then need to handle validation bad.

Neil said this was semi-complicated as its outside the typical forms loop - so to finish this we'd need to discuss it more.

johncclayton avatar Aug 18 '17 09:08 johncclayton