2. Make a JavaScript Data Model

Using the information design model shown in Figure 9.1 above as the starting point, we make a JavaScript data model, essentially by adding checks and setters, as explained in Part 2 (Validation App Tutorial):

Figure 9.2. A JavaScript data model, for the object type Book

A JavaScript data model, for the object type Book

Notice that, for any multi-valued enumeration attribute (like someThings) we add a class-level check function for single values (like checkSomeThing) and another one for value sets (like checkSomeThings) returning an object of type ConstraintViolation, and a setter (like setSomeThings) for assigning a set of enumeration literals to the multi-valued enumeration attribute.