File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Requires -Version 7.0
2-
3- <#
4- . SYNOPSIS
5- Validates the settings output from Get-PSModuleSettings action.
6-
7- . DESCRIPTION
8- This script validates that the settings JSON output:
9- 1. Is not empty
10- 2. Conforms to the JSON schema (Settings.schema.json)
11- 3. Has the expected structure matching the reference (Settings.json)
12-
13- The settings JSON is expected to be provided via the SETTINGS_JSON environment variable.
14-
15- . EXAMPLE
16- $env:SETTINGS_JSON = $settingsJson
17- .\Validate-Settings.ps1
18- #>
19-
20- [CmdletBinding ()]
1+ [CmdletBinding ()]
212param ()
223
234# Check if settings JSON is provided via environment variable
@@ -51,19 +32,19 @@ Write-Host "Comparing with reference settings..."
5132$referencePath = Join-Path $PSScriptRoot ' Settings.json'
5233$expectedSettings = Get-Content $referencePath - Raw | ConvertFrom-Json
5334
54- <#
55- . SYNOPSIS
56- Compares the structure of two objects.
57-
58- . DESCRIPTION
59- Recursively compares the structure of an actual object against an expected object,
60- validating that all expected properties exist in the actual object.
61-
62- . OUTPUTS
63- System.String[]
64- Returns an array of error messages for any structural mismatches.
65- #>
6635function Test-ObjectStructure {
36+ <#
37+ . SYNOPSIS
38+ Compares the structure of two objects.
39+
40+ . DESCRIPTION
41+ Recursively compares the structure of an actual object against an expected object,
42+ validating that all expected properties exist in the actual object.
43+
44+ . OUTPUTS
45+ System.String[]
46+ Returns an array of error messages for any structural mismatches.
47+ #>
6748 [CmdletBinding ()]
6849 param (
6950 # The actual object to validate.
You can’t perform that action at this time.
0 commit comments