You can use custom Joi validation schemas to validate the following parts of stack configuration:
You use the schemas property to specify which schemas Takomo should use for validation.
In this example we have specified to use myDataSchema schema to validate data configuration. For tags, we have two schemas: commonTags and environmentTag.
The implementation of myDataSchema schema provider could look like this:
The file exports an object with two properties name and init. The former specifies the schema's name used to refer to it from configuration files and the latter is a function that initializes the schema object.
The implementation of commonTags schema provider could look like this:
Finally, we have the implementation of environmentTag schema provider:
Unlike the other schema providers, its init function uses properties from the stack configuration file that are passed via the props argument.
schemas property can be defined in:
When schemas property is defined in a stack group configuration file:
When schemas property is defined in a blueprint configuration file:
When schemas property is defined in a stack configuration file:
Configuration merging happens when a stack group, blueprint or stack inherits schemas property but also defines schemas property of its own.
Schemas defined by the inheritor are appended to the inherited list of schemas.
The schemas property must satisfy these requirements:
data, tags, parameters and name.