Hi all
I have written a script (let’s call it X.ps1) which pulls data from one system via a small API wrapper (A.psm1), manipulates it and then sends it via POST or PUT to a second system, via another API wrapper (B.psm1).
A.psm1 > X.ps1 > [do some stuff] > B.psm1
System B has some quirks, which mean that I need to validate the output from System A before sending it. E.g. if “Gender” is not “M” or “F”, the request fails - this often causes issues if the field is empty/null in System A. Adding basic validation is simple enough, but I am not sure where to put it. Should X.ps1 check the data before invoking commands in B.psm1? Or should B.psm1 do the validation and send back warnings/errors to X.ps1 ?
Cheers!