To define and use data models in your project, create a directory named "📦" in the root
of your project. This directory will contain
.yaml files that
define the model names and fields, as well as the structure of
parent/child (container) relationships.
The file name indicates both the name of the model as well as the model's type. The model's type is denoted with a specific emoji prefix.
- Universal -- prefix file with 🌐
- Content -- prefix file with 📄
- User Profile -- prefix file with 👤
- Embedded (Global) -- prefix with 📎
Within the directory "📦", and given a file name named
a "Universal" model named
Article will be available to your scripts.
To define models that are in a container, place them into directories. Example files and folders in the "📦" directory which define 3 model types, two of which are in containers.
🌐Account.yaml Account/🌐List.yaml Account/List/🌐Task.yaml
Field names must follow "camel case" conventions, e.g. "camel" or "camelCase". All defined fields are indexed and required by default. Field definitions have a short form and long form, which can be mixed and matched as needed in the same file. Note: .yaml files use spaces, not tabs, for indentation.
To compactly use all defaults for a field, simply assign a field type immediately following your field name.
fieldName: string otherField: boolean somethingEmbed: EmbeddedModelName
To define additional field properties use the long form. In the long form you only need to define the properties you're interested in.
fieldName: type: string optional: true unique: true otherField: type: boolean
Global embedded model types have a distinct name and configuration file, and may be referenced in a configuration file like any other field type.
Local embedded model types are defined directly in the model that uses them.
item: type: price: double
Whether defined globally or locally, embedded values can allow multiple values (up to 20 entries) by adding "" after the field name:
items: type: price: double
If requirements don't call for the maximum of 20 entries, then provision less entries by specifying a number (less than 20) between the brackets.