diff --git a/format.md b/format.md index 27f912d..a9d62a4 100644 --- a/format.md +++ b/format.md @@ -116,7 +116,7 @@ A good example is the (possibly simplest) module-exposed template of the [`meta/ [input.value] transforms = ["meta/text:value"] subobjects = [] -conditions = [] +conditions = {} array = false ``` @@ -139,16 +139,11 @@ Array of objects & their properties under `input`, that this property matches th Object of arrays of references to other properties within the object, which may be itself, combined with values the target property must have for this property to be valid in the object instance. Some examples: ```toml -conditions = { - "input.value": ["owo"], - "input.version": ["fact-checked by real transgender patriots"] -} +conditions = {input.value: ["owo"], input.version: ["fact-checked by real transgender patriots"]} ``` ```toml -conditions = { - "input.version": ["function", "transform", "subobject", "custom"] -} +conditions = {input.version: ["function", "transform", "subobject", "custom"]} ``` If the parent property of a property with conditions is an array, the conditions apply to all items of the array. @@ -159,11 +154,25 @@ If `true`, the property will act as a collection of properties (referred to as a ## Functions -Functions (enum variant `wgu::modules::ModuleItem::Function`) are for calculating more object instances from existing object instances. +> a lot of things here will have an 'in general' before them! those things are not a strict requirement of the specification, but are heavily recommended. -### Validators +Functions (enum variant `wgu::modules::ModuleItem::Function`) are for calculating more object instances from existing object instances. Functions are also used for ensuring the integrity and accuracy of data contained within object instances. Such functions (known as 'validators') take one object instance, and return one log (struct `wgu::types::Log`) about the state of said object instance. In general, validators have the name `validator` - thus, they are addressed as *`object_type`*`:func:validator` -Validators (enum variant `wgu::modules::ModuleItem::Validator`) are for ensuring the integrity and accuracy of data contained within object instances. Validators take one object instance, and return one log (struct `wgu::types::Log`) about the state of said object instance. +A function takes a `FunctionData` as input and optionally another as parameters. The difference between inputs and parameters is that (in general) inputs are data the function works with, while parameters are the specifics of handling the data itself. A good example of that would be a function which produces an SHA digest of a `meta/text:input.value` (function templates will be explained in a bit): + +```toml +[inputs.main] +required = true +object_type = "meta/text" +conditions = {} +amount = 1 + +[params.algorithm] +required = true +object_type = "meta/text" +conditions = {} +amount = 1 +``` ## Modularity @@ -176,5 +185,4 @@ The reference strings for module items are defined as follows: | variant of `wgu::modules::ModuleItem` | reference string | | ------------------------------------- | ------------------------------------------ | | `Template` | *`object type`* | -| `Validator` | *`object type`*`:func:validator` | | `Function` | *`(optional) object type`*`:func:`*`name`* |