Summary
ConditionGroupTransformAttribute.Transform attempts to call [ConditionGroup]::FromJson($json) when the input is a string file path. ConditionGroup has no FromJson static method — FeatureFlag and PropertySet both have one, but ConditionGroup was never given one. Any string passed through this transform attribute throws MethodNotFound.
File
Gatekeeper/Classes/FeatureFlag.ps1:234
Reproduction
# Test-Condition has [ConditionGroupTransformAttribute()] on -Condition
Test-Condition -Context $ctx -PropertySet $props -Condition '.\mycondition.json'
# Throws: Method invocation failed because [ConditionGroup] does not contain a
# static method named 'FromJson'
Fix Options
Option A — Add the missing method to ConditionGroup:
static [ConditionGroup] FromJson([string]$json) {
$data = ConvertFrom-JsonToHashtable -InputObject $json
return [ConditionGroup]::new($data)
}
Option B — Remove the string/file-path branch from the transform attribute if loading conditions from standalone files is not a supported use case.
Notes
- Good first issue
- Found by Jordan B., Sage Nakamura, Chip Torres, Shawn Wee!-ler, and Glenn
Summary
ConditionGroupTransformAttribute.Transformattempts to call[ConditionGroup]::FromJson($json)when the input is a string file path.ConditionGrouphas noFromJsonstatic method —FeatureFlagandPropertySetboth have one, butConditionGroupwas never given one. Any string passed through this transform attribute throwsMethodNotFound.File
Gatekeeper/Classes/FeatureFlag.ps1:234Reproduction
Fix Options
Option A — Add the missing method to
ConditionGroup:Option B — Remove the string/file-path branch from the transform attribute if loading conditions from standalone files is not a supported use case.
Notes