mercredi 10 avril 2019

Validation Logic - MicroService client

My application (Java based) is invoking a third party Microservice to perform some business operations.

In most common use case, the third party Service accepts user's Personally identifiable information (PII) and returns a matching consumer entry. if any of the input is missing, services would return an error through some error code/error message pattern.Since it's a third party service, we do not control those aspects.

My question is, 1) From the validation perspective, does Client (i.e. my application) should perform validation for the input parameter before invoking the Service?

2) Or shall we rely on Services validation routine?

Benefit with 1st approach that I see is: a) Full control over validation b) Clean error handling, because we can attach specific error messages with validation logic c) If input data is not valid, we can avoid calling services

Benefit with 2nd approach that I see is: a) Caller need not worry about the validation logic

b) And we can completely rely on services to provide error messages/codes that Caller can print in the error logs to indicate errors.

Aucun commentaire:

Enregistrer un commentaire