File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,12 +80,19 @@ function Test-JsonManifest {
8080 }
8181
8282 # Parameters validation
83- if ($jsonObject.PSObject.Properties [' parameters' ]) {
83+ # Parameters validation
84+ if ($jsonObject.PSObject.Properties [' parameters' ] -and $jsonObject.parameters -and $jsonObject.parameters.Count -gt 0 ) {
8485 Test-JsonManifestParameters - Parameters $jsonObject.parameters
8586 }
8687
8788 # Content validation
88- Test-JsonManifestContent - Content $jsonObject.content
89+ # Content validation
90+ # Content validation
91+ if ($jsonObject.content -and $jsonObject.content.Count -gt 0 ) {
92+ Test-JsonManifestContent - Content $jsonObject.content
93+ } else {
94+ throw " Content section cannot be empty"
95+ }
8996
9097 Write-PlasterLog - Level Debug - Message " JSON manifest validation successful"
9198 return $true
@@ -107,6 +114,7 @@ function Test-JsonManifestParameters {
107114 [CmdletBinding ()]
108115 param (
109116 [Parameter (Mandatory )]
117+ [AllowEmptyCollection ()]
110118 [object []]$Parameters
111119 )
112120
@@ -171,6 +179,7 @@ function Test-JsonManifestContent {
171179 [CmdletBinding ()]
172180 param (
173181 [Parameter (Mandatory )]
182+ [AllowEmptyCollection ()]
174183 [object []]$Content
175184 )
176185
@@ -808,7 +817,7 @@ function Test-PlasterCondition {
808817 $errorMsg = if ($ParameterName ) {
809818 " Invalid condition in parameter '$ParameterName ': $ ( $errors [0 ].Message) "
810819 } else {
811- " Invalid condition in $Context : $ ( $errors [0 ].Message) "
820+ " Invalid condition in ${ Context} : $ ( $errors [0 ].Message) "
812821 }
813822 throw $errorMsg
814823 }
You can’t perform that action at this time.
0 commit comments