Skip to content

Commit baa8b71

Browse files
authored
style: add ValidateNotNullOrEmpty to ManifestHelpers mandatory string params (#8)
Completes the cross-repo validator alignment with PowerShellModuleTemplate#23. PR #7 (2026-05-10) added the validator to `Split-SemVerString -VersionString`; this commit covers the remaining six mandatory `[string]` parameters across `Compare-SemVerPrerelease`, `Test-VersionComparison`, and `Test-VersionConstraint`. Behavior for valid inputs is unchanged. Misuse (null or empty version/prerelease strings) now fails at parameter binding instead of producing downstream NullReferenceExceptions inside the comparison logic.
1 parent c8f8339 commit baa8b71

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/ManifestHelpers.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ function Compare-SemVerPrerelease {
8989
[OutputType([int])]
9090
param(
9191
[Parameter(Mandatory = $true)]
92+
[ValidateNotNullOrEmpty()]
9293
[string]$FirstPrerelease,
9394

9495
[Parameter(Mandatory = $true)]
96+
[ValidateNotNullOrEmpty()]
9597
[string]$SecondPrerelease
9698
)
9799

@@ -205,13 +207,15 @@ function Test-VersionComparison {
205207
[OutputType([bool])]
206208
param(
207209
[Parameter(Mandatory = $true)]
210+
[ValidateNotNullOrEmpty()]
208211
[string]$FirstVersion,
209212

210213
[Parameter(Mandatory = $false)]
211214
[AllowNull()]
212215
[string]$FirstPrerelease,
213216

214217
[Parameter(Mandatory = $true)]
218+
[ValidateNotNullOrEmpty()]
215219
[string]$SecondVersion,
216220

217221
[Parameter(Mandatory = $false)]
@@ -322,9 +326,11 @@ function Test-VersionConstraint {
322326
[OutputType([bool])]
323327
param(
324328
[Parameter(Mandatory = $true)]
329+
[ValidateNotNullOrEmpty()]
325330
[string]$ManifestVersion,
326331

327332
[Parameter(Mandatory = $true)]
333+
[ValidateNotNullOrEmpty()]
328334
[string]$RequirementsVersion,
329335

330336
[Parameter(Mandatory = $true)]

0 commit comments

Comments
 (0)