Validate sensors types
Closed this issue · 2 comments
We should (?) maintain a table (not necessarily a DB one) with the list of sensors we "support". Only so that we keep that list healthy (e.g. no different names for the exact same model), for later (e.g. queries).
The best way to do this would be to do it at schema level (see Measurement.sensor definition in app/schemas.py):
-
It will enforce the list at the API level, even before it reaches the DB, and it will give meaningful error to the client, basically for free because that is how FastAPI/Pydantic works.
-
It will automatically include that information in the autogenerated docs.
We could maintain a json file in data with the list of sensors, so we don't mix it with code, and simply load the list from schemas.py.
Maybe there's more to consider here.