Menu

I added 10 validation rules to an e-invoice parser without changing one existing warning. Here is the test setup
📰

I added 10 validation rules to an e-invoice parser without changing one existing warning. Here is the test setup

DEV Community: api·Fast Data·8 days ago
#HDpPGhpa
#devtoapi#devto#dev#files#rule
Reading 0:00
15s threshold

The validation output of my e-invoice parser had a design flaw: it was a list of English sentences.

"validationWarnings" : [ "Tax basis + VAT = 1728.70, but grand total is 1729 (BR-CO-15)" ]

Enter fullscreen mode

Exit fullscreen mode

Fine for a human. Bad for an accounts-payable workflow that wants to block on real errors, only log hints, and show the user which field is wrong. The only way to do that was to parse the strings. And once output is published, it is an API, whether you like it or not.

So this week's job was: add machine-readable findings and more rules without changing a single existing string , because any workflow built on the old output has to keep working.

Disclosure: I built the XRechnung & ZUGFeRD Parser on Apify. This post is about the testing approach, which works for any parser.

The new shape

Every finding now has a rule ID, a severity and the business term it refers to.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.