This is just 1 post! You should check out the rest of it! You can also subscribe to my RSS feed.

PS: AI

2023-04-15

After publishing my last post about how I handle API validation and typing in my deno + oak backend, I asked Phind, an AI-powered search engine, the same question, although not very well formulated:

With deno and oak, how can I validate the input and cast it in the different routes?

To my surprise, the AI answered like this:

one way is to use the built-in validation middleware provided by Oak, called validator.

It seems like I could just import validator and validation functions like isNumber from Oak and just use that in the most compact way imaginable in my middleware. Phing provided source code snippets that made we question my Google-fu. How could I not see this when I researched my options?

I queried Phing for more examples, and it gave me a full list of the possible validation functions and more code examples.

However, I was not able to find validator or any of the validation functions in Oak's documentation. So I told Phing that the validator is not there.

Grudgingly (or so I imagine) the AI confessed that it is true that their proposed solution simply does not exist. But before version 6 it sure did! (Currently, Oak is at version 11.) I tried to browse through version 6 to find something like the validator, but to no avail.

It seems that Kevin Yank is very correct about AI when he said:

Until you’ve sat aghast at the sight of a confident, detailed, but completely wrong answer, you will have no understanding of the skepticism you need to apply to the guidance it provides.


This is just 1 post! You should check out the rest of it! You can also subscribe to my RSS feed.