Skip to content

[Test-ObjectGraph] Parents of failing item are also included in the output #126

@ykuijs

Description

@ykuijs

When the cmdlet finds an issue in the data, the output also contains all parents of that item. This means that a single (small) issue in the data can result in big list of errors. Would be great to either:

  • Add an -IgnoreParent parameter that ignores all parent errors
  • Or change the default behaviour to not include parents add an -IncludeParents parameter to specify that you are interested in the parents as well.

Reproduction:

$data = @{
    NonNodeData = @{
        AzureAD = @{
            IncorrectParameterName = @(
                @{
                    Param1 = 8
                }
            )
        }
    }
}

$schema = @{
    NonNodeData = @{
        '@Type' = 'PSMapNode'
        AzureAD = @{
            '@Type' = 'PSMapNode'
        }
    }
}

$result = $data | Test-Object $schema
$result

Output:

Path                Value                        Valid Issue
----                -----                        ----- -----
NonNodeData.AzureAD @{IncorrectPa…=@(…)}          [X]  The following nodes are not accepted: IncorrectPa…
NonNodeData         @{AzureAD=@{IncorrectPa…=…}}  [X]  The following nodes are not accepted: AzureAD
                    @{NonNodeData=@{AzureAD=…}}   [X]  The following nodes are not accepted: NonNodeData

The first issue is the actual issue, but the bottom two issues are parents of the top issue. If you resolve the top issue, the bottom two are automatically fixed as well.

There is no specific action needed for fixing the bottom two issues, so that is why I would like to be able to filter those from the output.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions