A team of developers has introduced a new data constraint language — CUE that combines types and values into a single concept. It’s an open-source data validation language, inspired by Google’s General Configuration Language (GCL) and aims to make tasks that involve defining and using data simpler.
CUE comes with two core properties that set it apart from other configuration languages. First, it considers types as values and second, these values are ordered into a lattice, a partially ordered set. Talking about applications of CUE, it includes data validation, data templating, configuration, code generation, querying, etc.
According to the developers, “CUE merges the notion of schema and data. The same CUE definition can simultaneously be used for validating data and act as a template to reduce boilerplate. “Schema definition is enriched with fine-grained value definitions and default values. At the same time, data can be simplified by removing values implied by such detailed definitions. The merging of these two concepts enables many tasks to be handled in a principled way,” they also added.
CUE makes it quite easier to define and verify the schema using the ‘cue’ command-line tool. You can use CUE constraints to verify document-oriented databases like MongoDB.
This new data validation improves readability by allowing the one file single definition applicable to values in many other files. If you a developer, you won’t have to open various files for verifying the validity.
As it combines constraints from multiple resources, redundancy has always been an issue. With CUE, its logical inference engine will address this issue by reducing constraints automatically. Its API also allows selecting between different normal forms for optimized representation.
As of now, CUE can only extract Protobuf and Go code definitions. It allows annotation of existing sources with CUE expressions and facilitates the use of existing sources or smoother transition.
Read more: https://agilehorde.blogspot.com/2019/11/introducing-cue-open-source-data.html