-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When the schema specifies that a parameter is required and another parameter is not correct (incorrect type or using parameter that is unknown), those other parameters are not listed as failed.
Reproduction:
- DefaultLength is specified as string, but the schema expects and int.
- The property DoesNotExist is not specified in the schema.
$data = @{
NonNodeData = @{
AzureAD = @{
AuthenticationMethodPolicy = @(
@{
DefaultLength = 'string'
DoesNotExist = 'string'
DefaultLifetimeInMinutes = 10
}
)
}
}
}
$schema = @{
NonNodeData = @{
'@Type' = 'PSMapNode'
AzureAD = @{
'@Type' = 'PSMapNode'
AuthenticationMethodPolicy = @(
@{
'@Type' = 'PSMapNode'
DefaultLength = @{ '@Type' = 'Int' }
DefaultLifetimeInMinutes = @{ '@Type' = 'Int' }
Ensure = @{ '@Type' = 'String' }
Id = @{ '@Type' = 'String'; '@Required' = $true }
IncludeTargets = @(
@{
'@Type' = 'PSMapNode'
Id = @{ '@Type' = 'String' }
TargetType = @{ '@Type' = 'String' }
}
)
IsUsableOnce = @{ '@Type' = 'Bool' }
MaximumLifetimeInMinutes = @{ '@Type' = 'Int' }
MinimumLifetimeInMinutes = @{ '@Type' = 'Int' }
State = @{ '@Type' = 'String' }
}
)
}
}
}
$result = $data | Test-Object $schema
$resultOutput:
Path Value Valid Issue
---- ----- ----- -----
NonNodeData.AzureAD.AuthenticationMethodPolicy[0] @{DefaultLeng…='string';DefaultLife…=10} [X] The required node condition 'Id' is not met
NonNodeData.AzureAD.AuthenticationMethodPolicy @(@{DefaultLeng…=…;…}) [X] The following nodes are not accepted: 0
NonNodeData.AzureAD @{Authenticat…=@(…)} [X] The following nodes are not accepted: Authenticat…
NonNodeData @{AzureAD=@{Authenticat…=…}} [X] The following nodes are not accepted: AzureAD
@{NonNodeData=@{AzureAD=…}} [X] The following nodes are not accepted: NonNodeDataThe incorrect type of the DefaultLength parameter and the fact that the DoesNotExist parameter is unknown are missing in the list. I would have expected that the code would output all discovered issues.
Metadata
Metadata
Assignees
Labels
No labels