http4s: JSON Request Validator

There are three things a software developer can watch forever: fire, water, and request validators. In the previous blog post, I demonstrated how to develop a simple REST API application with http4s. But that app has a drawback  — the user can send any invalid data to the API and it will be processed with no error messages.

You may also like: Implementing Validation for RESTful Service With Spring Boot

The Problem

The main problem of 99.99 percent of web apps is that they have users (and feel free to tweet this). As a result, there is a huge human factor, which leads to a tremendous amount of inappropriate interactions with web applications. One of my favorites is invalid data input. For example, the user may enter "blablabla" in an email field, "MyNickName" in a phone number field or even leave a form field empty when it's required.