PSRule-options.schema.json

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "PSRule options",
    "description": "A schema for PSRule YAML options files.",
    "oneOf": [
        {
            "$ref": "#/definitions/options"
        }
    ],
    "definitions": {
        "configuration": {
            "type": "object",
            "title": "Configuration values",
            "description": "A set of key/ value configuration options for rules."
        },
        "binding-v0.3.0": {
            "type": "object",
            "title": "Object binding",
            "description": "Configure property/ object binding options.",
            "properties": {
                "ignoreCase": {
                    "type": "boolean",
                    "title": "Ignore case",
                    "description": "Determines if custom binding uses ignores case when matching properties. The default is true.",
                    "default": true
                },
                "targetName": {
                    "type": "array",
                    "title": "Bind TargetName",
                    "description": "Specifies one or more property names to bind TargetName to.",
                    "items": {
                        "type": "string"
                    },
                    "uniqueItems": true
                },
                "targetType": {
                    "type": "array",
                    "title": "Bind TargetType",
                    "description": "Specifies one or more property names to bind TargetType to.",
                    "items": {
                        "type": "string"
                    },
                    "uniqueItems": true
                }
            },
            "additionalProperties": false
        },
        "execution-v0.2.0": {
            "type": "object",
            "title": "Execution options",
            "description": "Options that affect rule execution.",
            "properties": {
                "languageMode": {
                    "type": "string",
                    "title": "Language mode",
                    "description": "The PowerShell language mode to use for rule execution. The default is FullLanguage.",
                    "enum": [
                        "FullLanguage",
                        "ConstrainedLanguage"
                    ],
                    "default": "FullLanguage"
                },
                "inconclusiveWarning": {
                    "type": "boolean",
                    "title": "Warn on inconclusive rules",
                    "description": "Enable or disable warnings for inconclusive rules. The default is true.",
                    "default": true
                },
                "notProcessedWarning": {
                    "type": "boolean",
                    "title": "Warn on unprocessed objects",
                    "description": "Enable or disable warnings for objects that are not processed by any rule. The default is true.",
                    "default": true
                }
            },
            "additionalProperties": false
        },
        "input-option": {
            "type": "object",
            "title": "Input options",
            "description": "Options that affect how input types are processed.",
            "properties": {
                "format": {
                    "type": "string",
                    "title": "Input format",
                    "description": "The input string format. The default is Detect, which will try to detect the format when the -InputPath parameter is used.",
                    "enum": [
                        "None",
                        "Yaml",
                        "Json",
                        "Markdown",
                        "Detect"
                    ],
                    "default": "Detect"
                },
                "objectPath": {
                    "type": "string",
                    "title": "Object path",
                    "description": "The object path to a property to use instead of the pipeline object."
                },
                "targetType": {
                    "type": "array",
                    "title": "Target type",
                    "description": "Only process objects that match one of the included types.",
                    "items": {
                        "type": "string"
                    },
                    "uniqueItems": true
                }
            },
            "additionalProperties": false
        },
        "logging-v0.8.0": {
            "type": "object",
            "title": "Logging options",
            "description": "Options for configuring information logging.",
            "properties": {
                "limitDebug": {
                    "type": "array",
                    "title": "Scopes for debug messages",
                    "description": "Limits debug messages to a list of named debug scopes. No scopes are set by default.",
                    "items": {
                        "type": "string"
                    },
                    "uniqueItems": true
                },
                "limitVerbose": {
                    "type": "array",
                    "title": "Scopes for verbose messages",
                    "description": "Limits verbose messages to a list of named verbose scopes. No scopes are set by default.",
                    "items": {
                        "type": "string"
                    },
                    "uniqueItems": true
                },
                "ruleFail": {
                    "type": "string",
                    "title": "Report fail to stream",
                    "description": "Log fail outcomes for each rule to a specific informational stream. The default is None.",
                    "enum": [
                        "None",
                        "Error",
                        "Warning",
                        "Information"
                    ],
                    "default": "None"
                },
                "rulePass": {
                    "type": "string",
                    "title": "Report pass to stream",
                    "description": "Log pass outcomes for each rule to a specific informational stream. The default is None.",
                    "enum": [
                        "None",
                        "Error",
                        "Warning",
                        "Information"
                    ],
                    "default": "None"
                }
            },
            "additionalProperties": false
        },
        "suppression-v0.2.0": {
            "type": "object",
            "title": "Suppress rules",
            "description": "Specifies suppression rules.",
            "uniqueItems": true,
            "additionalProperties": {
                "oneOf": [
                    {
                        "type": "array",
                        "title": "Suppressed rule",
                        "description": "The name of the rule to suppress.",
                        "items": {
                            "type": "string",
                            "title": "Suppress when",
                            "description": "Suppress the rule on TargetNames to suppress."
                        },
                        "uniqueItems": true
                    },
                    {
                        "type": "object",
                        "title": "Suppressed rule",
                        "description": "The name of the rule to suppress.",
                        "properties": {
                            "targetName": {
                                "type": "array",
                                "title": "Suppress when",
                                "description": "One or more TargetNames to suppress.",
                                "items": {
                                    "type": "string"
                                },
                                "uniqueItems": true
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "targetName"
                        ]
                    }
                ]
            }
        },
        "output": {
            "type": "object",
            "title": "Output options",
            "description": "Options that affect how output is generated.",
            "properties": {
                "as": {
                    "type": "string",
                    "title": "Result type",
                    "description": "Determine if detailed or summary results are generated. The default is Detail.",
                    "enum": [
                        "Detail",
                        "Summary"
                    ],
                    "default": "Detail"
                },
                "encoding": {
                    "type": "string",
                    "title": "Encoding",
                    "description": "The encoding to use when writing results to file. The default is Default, UTF-8 without BOM.",
                    "enum": [
                        "Default",
                        "UTF8",
                        "UTF7",
                        "Unicode",
                        "UTF32",
                        "ASCII"
                    ],
                    "default": "Default"
                },
                "format": {
                    "type": "string",
                    "title": "Output format",
                    "description": "The output format to use when returning results. The default is None.",
                    "enum": [
                        "None",
                        "Yaml",
                        "Json",
                        "NUnit3",
                        "Csv",
                        "Wide"
                    ],
                    "default": "None"
                },
                "path": {
                    "type": "string",
                    "title": "Output path",
                    "description": "The file path location to save results."
                },
                "style": {
                    "type": "string",
                    "title": "Output Style",
                    "description": "The style that results will be presented in.",
                    "enum": [
                        "Client",
                        "Plain",
                        "AzurePipelines",
                        "GitHubActions"
                    ],
                    "default": "Client"
                }
            },
            "additionalProperties": false
        },
        "options": {
            "properties": {
                "binding": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/binding-v0.3.0"
                        }
                    ]
                },
                "configuration": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/configuration"
                        }
                    ]
                },
                "execution": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/execution-v0.2.0"
                        }
                    ]
                },
                "input": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/input-option"
                        }
                    ]
                },
                "logging": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/logging-v0.8.0"
                        }
                    ]
                },
                "output": {
                    "type": "object",
                    "$ref": "#/definitions/output"
                },
                "rule": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/rule-option"
                        }
                    ]
                },
                "suppression": {
                    "type": "object",
                    "oneOf": [
                        {
                            "$ref": "#/definitions/suppression-v0.2.0"
                        }
                    ]
                }
            },
            "additionalProperties": false
        },
        "rule-option": {
            "type": "object",
            "title": "Baseline options",
            "description": "Options that include/ exclude and configure rules.",
            "properties": {
                "include": {
                    "type": "array",
                    "title": "Include rules",
                    "description": "Optionally filter to rules by name.",
                    "$ref": "#/definitions/rule-names"
                },
                "exclude": {
                    "type": "array",
                    "title": "Exclude rules",
                    "description": "Specifies rules to exclude by name.",
                    "$ref": "#/definitions/rule-names"
                },
                "tag": {
                    "type": "object",
                    "title": "Tags",
                    "description": "Rules to include by tag in the baseline.",
                    "additionalProperties": {
                        "type": "string"
                    }
                }
            },
            "additionalProperties": false
        },
        "rule-names": {
            "type": "array",
            "items": {
                "type": "string",
                "$ref": "#/definitions/rule-name"
            },
            "uniqueItems": true
        },
        "rule-name": {
            "type": "string",
            "minLength": 3
        }
    }
}