12 Advanced data validation

A self-made gift

This chapter covers

  • Validating function arguments
  • Validating function return values
  • Data validation beyond static types
  • Automatic generation of data model diagrams
  • Automatic generation of schema-based unit tests

As the size of a code base grows in a project that follows DOP principles, it becomes harder to manipulate functions that receive and return only generic data. It is hard to figure out the expected shape of the function arguments, and when we pass invalid data, we don’t get meaningful errors.

Until now, we have illustrated how to validate data at system boundaries. In this chapter, we will illustrate how to validate data when it flows inside the system by defining data schemas for function ...

Get Data-Oriented Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.