0

My company, which specializes in logistics and transportation, delegated the majority of the backend microservices to our team. All of the microservices (which our team inherited from "past generations") appear to have inconsistent input field validation. Mobile number format validation is a good example. There would undoubtedly be a need to add other validations, such as prefixes and other mobile number lengths to take into account, if our clientele expanded to other nations.

Also, not all microservices read from the same databases.

How should this mobile number format validation be centralized across all microservices, in your opinion? The only other option that comes to mind is creating a separate microservice for this, but this seems to be an overkill considering that for now, this will only be applied to mobile number format validation. The same is true for Drools, a business rules engine. Are there other available options for smaller scale rules like this one?

  • can you give more details about the technology you are using? the first thing that comes to my mind, that you can apply if your microservices communicate via REST, is to use openapi specs (the old swagger) with a source generator to generate the endpoints and related validation. You could define the phone number field with its own validation in a separate file reused by the specs of the different microservices – ddfra Aug 18 '23 at 06:30
  • I have worked with systems where data like phone numbers and postal addresses have been validated by separate services. They were actually external services. It worked well and didn't introduce any significant performance impact. Essentially, this kind of data was treated as a DDD generic sub-domain. – David Osborne Aug 18 '23 at 07:45

0 Answers0