Separating the service layer from the validation layer
Short answer: You are validating the wrong thing. Very long answer: You are trying to validate a PurchaseOrder but that is an implementation detail. Instead what you should validate is the operation itself, in this case the partNumber and supplierName parameters. Validating those two parameters by themselves would be awkward, but this is caused by … Read more