Documentation

gitHub

Choices

JSON Schema includes keywords to allow the combination of schemas and corresponding to the boolean algebra concepts AND, OR, XOR, and NOT.

 

The keywords used to combine schemas are:

  • allOf: (AND) Must be valid against all of the sub-schemas
  • anyOf: (OR) Must be valid against any of the sub-schemas
  • oneOf: (XOR) Must be valid against exactly one of the sub-schemas

All of these keywords must be set to an array, where each item is a schema.

In addition, there is:

  • not: (NOT) Must not be valid against the given schema

 

Hackolade was build from scratch on top of JSON Schema, and we fully support the concept of choices, provided that the model target supports it.  For example, RDBMS targets do not, so the functions is disabled.

 

You may add choices to your model either from the ERD pane, or from the hierarchical tree view, the latter being often chosen as simpler to understand and visualize.

 

Instead of adding a simple attribute, choose

oneOf choice create

 

This action automatically creates 2 sub-schema objects.

Image

 

Then you can define each sub-schema:

oneOf choice subschemas structure

 

 

 

 

You will find more information on this page