Domain

The other parts wouldn't make much sense without first defining the resulting data structure where the user input will live. For this reason the domain definition file is the one that sets Konfoo options and ties together all the parts that make up a fully functioning configurator.

It is probably best to start with a simple example:

root: MyDomainEntity
options:
    form: my-form.yml

MyDomainEntity:
    text_field: string
    bool_field: bool

The above defines a single domain entity MyDomainEntity that has two configurable fields called text_field and bool_field - as you can probably guess the value after the key signifies the type, more on that in Types.

You may have also noticed that there are a few reserved root-level keys that have special meaning, these are:

  • root - which defines the main domain entity that will contain all the rest of the configuration substructures
  • options - this can enable or disable a number of Konfoo features and is discuessed in Options
  • types - this allows you to define new types that can be reused across all domain entities (see Type Definitions)

Every other root-level key in this YAML document is considered to be a domain entity and is expected to have the following structure:

NameOfDomainEntity:
    field_1: field_type
    field_2: field_type
    # ...
    field_N: field_type

It is important to note that every configuration is a tree structure where there is always a single domain entity at the top (root). Each domain entity can in turn contain other entities - either as a value on a field or as elements of a list.