generic validation for output and input ports (connection can only go from output to input)