diff --git a/CHANGELOG.md b/CHANGELOG.md index cf23883..6c862b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/). any `IDictionary` instead of only exact `System.Collections.Hashtable`, so configuration built via `ConvertFrom-Json -AsHashtable` (which returns an `OrderedHashtable`) and other ordered/generic dictionaries bind correctly. +- `PropertySetTransformAttribute` no longer calls the broken, argument-less + `Read-PropertySet` when `-PropertySet` is omitted (that call could never + bind and always threw). `-PropertySet` is now a mandatory parameter on + `Test-FeatureFlag`, matching `Test-Condition`, so the missing value is + reported with a clear mandatory-parameter error instead. (#84) ## [1.0.0] 2026-06-05 diff --git a/Gatekeeper/Classes/Property.ps1 b/Gatekeeper/Classes/Property.ps1 index 85c71fb..afb68a7 100644 --- a/Gatekeeper/Classes/Property.ps1 +++ b/Gatekeeper/Classes/Property.ps1 @@ -186,7 +186,7 @@ class PropertySetTransformAttribute : System.Management.Automation.ArgumentTrans [object] Transform([System.Management.Automation.EngineIntrinsics]$engineIntrinsics, [object] $inputData) { if ($null -eq $inputData) { - return $(Read-PropertySet) + return $null } if ($inputData -is [PropertySet]) { return $inputData diff --git a/Gatekeeper/Public/Test-FeatureFlag.ps1 b/Gatekeeper/Public/Test-FeatureFlag.ps1 index 76f8ed3..632fe5e 100644 --- a/Gatekeeper/Public/Test-FeatureFlag.ps1 +++ b/Gatekeeper/Public/Test-FeatureFlag.ps1 @@ -36,6 +36,8 @@ [FeatureFlag] [FeatureFlagTransformAttribute()] $FeatureFlag, + [Parameter(Mandatory)] + [ValidateNotNull()] [PropertySet] [PropertySetTransformAttribute()] $PropertySet, diff --git a/docs/en-US/Test-FeatureFlag.md b/docs/en-US/Test-FeatureFlag.md index 3a80470..1ee18af 100644 --- a/docs/en-US/Test-FeatureFlag.md +++ b/docs/en-US/Test-FeatureFlag.md @@ -13,7 +13,7 @@ Checks if the current machine's context will pass the feature flag rules. ## SYNTAX ``` -Test-FeatureFlag [-FeatureFlag] [[-PropertySet] ] [-Context] +Test-FeatureFlag [-FeatureFlag] [-PropertySet] [-Context] [-ProgressAction ] [] ``` @@ -60,7 +60,7 @@ Type: PropertySet Parameter Sets: (All) Aliases: -Required: False +Required: True Position: 2 Default value: None Accept pipeline input: False