Open heikkilv opened 1 year ago
Need to try pydantic to do this.
Pydantic could be used to check the Python types before calling the wasm module, and would be enough for most cases.
Some additional checks would likely be needed to handle for example the fact that Python has only one integer type with arbitrary precision, while the wasm function likely would take either 32-bit or 64-bit integers.
There should be some kind of validation for the user input when accessing the
/modules/<module_name>/<function_name>
endpoint.Currently if the input parameters are not correct types (or convertable to them), the app either crashes or becomes unresponsive. For example, trying the fibonacci function with input 5.5 does not return anything and the app must be restarted.
Similar validation would likely be required for the other endpoints that access the deployed Wasm modules.