4. Making Use of CDDL
In this section, we discuss several potential ways to employ CDDL.
4.1. As a Guide for a Human User
CDDL can be used to efficiently define the layout of CBOR data, such that a human implementer can easily see how data is supposed to be encoded.
Since CDDL maps parts of the CBOR data to human-readable names, tools could be built that use CDDL to provide a human-friendly representation of the CBOR data and allow them to edit such data while remaining compliant with its CDDL definition.
4.2. For Automated Checking of CBOR Data Structures
CDDL has been specified such that a machine can handle the CDDL definition and related CBOR data (and, thus, also JSON data). For example, a machine could use CDDL to check whether or not CBOR data is compliant with its definition.
The need for thoroughness of such compliance checking depends on the application. For example, an application may decide not to check the data structure at all and use the CDDL definition solely as a means to indicate the structure of the data to the programmer.
On the other hand, the application may also implement a checking mechanism that goes as far as checking that all mandatory map members are available.
The matter of how far the data description must be enforced by an application is left to the designers and implementers of that application, keeping in mind related security considerations.
In no case is it intended that a CDDL tool would be "writing code" for an implementation.
4.3. For Data Analysis Tools
In the long run, it can be expected that more and more data will be stored using the CBOR data format.
Where there is data, there is data analysis and the need to process such data automatically. CDDL can be used for such automated data processing, allowing tools to verify data, clean it, and extract particular parts of interest from it.
Since CBOR is designed with constrained devices in mind, a likely use of it would be small sensors. An interesting use would thus be automated analysis of sensor data.