Add nested objects and arrays
In the previous tutorial, we saw how to create a first data model, which was quite basic but allowed us to review different ways to enter information in Hackolade Studio, as well as different ways to visualize structures. By the end of this tutorial, you will master the creation of more complex data structures.
Note: complex data types are not available in all target technologies supported by Hackolade, in which case the feature is disabled. Or they may use a different terminology: map, struct, list, tuple, enumeration, ... Hackolade uses the terminology and data types supported by the target technology.
To append a sub-object in an ERD entity, we can right-click in the entity
We can do the same thing in the entity's tab:
While it is not possible to add a child attribute to a scalar data type, a complex (non-scalar) data type such as objects and arrays hold a sub-structure, for example:
Similarly, you can add an array where each item matches the same schema:
or tuples, with a sequence of ordered items with possibly different schemas
Note that in Hackolade for documentation purposes, you may assign a friendly name to an array item:
As expected, Hackolade Studio continues to generate the JSON Schema and sample JSON Data document. They are visible in the JSON Preview lower tab for each entity upper tab.
In this tutorial, we reviewed how to create more complex structures with objects and arrays. In the next tutorial, we will cover JSON Schema choices (oneOf, allOf, anyOf) as well as conditional application of subschemas, and pattern fields.