Configuration Schema: Default
Synopsis
The default schema is used to read the json files generated by Export-PSFConfig
.
Description
As a format designed to ingest auto-generated configuration files, the default schema is not designed with human authoring comfort in mind.
It provides a maximum of data fidelity, but is generally not recommended for files not generated through Export-PSFConfig
For a json format intended for human authoring, check out the powerful MetaJson Schema.
Input Format
Each setting in the configuration file is expected in one of two formats: Simple or Complex.
To define a setting as simple - which means it used full json serialization, rather than using the more complex but also more precise PSFramework syntax to specify values - when defining a configuration item in memory, use the -SimpleExport
switch on Set-PSFConfig
.
You can freely combine simple and complex settings with each other.
Simple format
The simple format requires three properties: Version, FullName & Data. You can also specify “Style” as “Simple”, but that is optional. All other properties on an entry are ignored.
Example:
[
{
"Version": 1,
"FullName": "Demo.Simple",
"Data": 42
}
]
Complex Format
The complex format requires five properties: Style (as “default”), Value, Version, FullName & Type.
Example:
[
{
"Style": "default",
"Value": "42",
"Version": 1,
"FullName": "Demo.Complex",
"Type": 3
}
]
- Style must always be “default”
- Value is the content as string. To get the value to specify in the above example, run
(Get-PSFConfig -Module Demo -Name Complex).RegistryData
after defining the setting. Everything after the first colon is the value to provide. - Version: Should be 1. Used to later track the format of the entry if the Configuration Schema updates its processing rules. This ensures there will be no breaking change in parsing the configuration file if you later updte the module but not the file.
- FullName: Name of the setting in its entirety.
- Type: When exporting, it will use the numeric representation, but specifying a readable string for the data type works as well. To get the string value of what to specify here in the above example, run
(Get-PSFConfig -Module Demo -Name Complex).RegistryData
after defining the setting. Everything before the first colon is the typename to specify here.
Combining settings
It is perfectly legal to combine any number of settings in either style to a single file:
[
{
"Style": "default",
"Value": "42",
"Version": 1,
"FullName": "Demo.Complex",
"Type": 3
},
{
"Version": 1,
"FullName": "Demo.Simple",
"Data": 42
}
]