datum icon indicating copy to clipboard operation
datum copied to clipboard

Deep structures cause warning when using Lookup or Get-DatumRsop

Open cibboy opened this issue 1 year ago • 0 comments

Due to the default depth of 2 for ConvertTo-Json, functions Invoke-TestHandlerAction, Merge-Datum and Merge-HashTable may write warning "Resulting JSON is truncated as serialization has exceeded the set depth of 2" when using deep structures. Try, for example:

Configurations:
- Test

Test:
  Depth1:
    Depth2:
      Depth3:
        Array:
        - value1
        - value2

The warning is shown even if -Debug or -Verbose are not used, since Powershell solves the command inside the string before checking whether such string has to follow the proper stream.

I suggest either using -Depth 10 (seems a reasonable depth without killing performance) or perhaps using the depth specified in $Datum.__Definition.default_lookup_options.

I'm available to create a PR.

cibboy avatar Feb 08 '24 10:02 cibboy