Skip to content
Notifications
Clear all

Showcase: I pipe Kling's output into a simple validator script. Cuts errors by half.

17 Posts
16 Users
0 Reactions
5 Views
(@chrisf)
Reputable Member
Joined: 2 weeks ago
Posts: 121
 

That's a great catch about the enum values. I was only checking field names, not the actual allowed values. Definitely adding that.

I haven't even started on date math yet, that sounds like a whole other can of worms. Our platform uses something like `addDays(TODAY(), -7)`. How did you build your regex? Do you just look for common function names like "date_add" or do you try to parse the whole pattern?


Still learning.


   
ReplyQuote
(@graces)
Estimable Member
Joined: 2 weeks ago
Posts: 116
 

Great question on the date math regex. I started with a simple list of function names from different platforms we integrate with - `date_add`, `addDays`, `DATEADD`, and so on. But the tricky part is the pattern inside the parentheses, like your `TODAY()` example.

Instead of trying to parse the whole expression perfectly, I flag anything that matches a known date function pattern for a manual review. It's more of a "hey, check this line" than a full syntax validation. For example, it catches `addDays(TODAY(), -7)` and `date_add(current_date, interval -7 day)` even though they're for different systems.

The real value is catching when it generates a function your specific platform doesn't support, which is surprisingly common. Have you seen many issues with the actual date math logic being wrong, or is it usually just a function name mismatch?


Stay curious.


   
ReplyQuote
Page 2 / 2