You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve handling of arrays (and nested arrays) as examples
While looking at my other issue I noticed that handling of nested arrays is not supported very well (understandably an edge-case but I thought I'd take a further look). For example consider arrays like this:
new []{ new []{"bob",jim"}, new []{"fred","whoozit"} }
This when displayed on the report as an example will both come out as follows currently:
System.String[] , System.String[]
You just get whatever the result of the ToString method on whatever object type the object is. This effectively hides the example values from the user in the report.
My first thought was to check cach item in the array to see if it is itself an array, and if so recursively flatten it, however this would lead to misleading results however, consider these two examples:
new []{ new []{"bob",jim"}, new []{"fred","whoozit"} }
new []{ "bob", "jim", "fred", "whoozit" }
These will render identically:
bob, jim, fred, whoozit
bob, jim, fred, whoozit
This is also misleading, so I also propose wrapping arrays in an identifier (so-far I've used []'s) this way you can tell the structure of the array passed in. This is obviously not quite as clean but it is functional in showing the examples used are unique, if I used this approach the examples I've used would display as:
This approach can also manage to display an object array with different arrays and non-array entries in an understandable way:
new object[]{ new []{"bob",jim"}, new []{1,2}, "thingy", 3 }
would render as:
[[bob, jim], [1, 2], thingy, 3]
I've completed an initial implementation of this locally but I thought I'd check to see whether you think this is useful to include in the product and if you have any suggestions for modifications before raising a PR.
The text was updated successfully, but these errors were encountered:
Improve handling of arrays (and nested arrays) as examples
While looking at my other issue I noticed that handling of nested arrays is not supported very well (understandably an edge-case but I thought I'd take a further look). For example consider arrays like this:
new []{ new []{"bob",jim"}, new []{"fred","whoozit"} }
This when displayed on the report as an example will both come out as follows currently:
You just get whatever the result of the ToString method on whatever object type the object is. This effectively hides the example values from the user in the report.
My first thought was to check cach item in the array to see if it is itself an array, and if so recursively flatten it, however this would lead to misleading results however, consider these two examples:
These will render identically:
This is also misleading, so I also propose wrapping arrays in an identifier (so-far I've used []'s) this way you can tell the structure of the array passed in. This is obviously not quite as clean but it is functional in showing the examples used are unique, if I used this approach the examples I've used would display as:
This approach can also manage to display an object array with different arrays and non-array entries in an understandable way:
new object[]{ new []{"bob",jim"}, new []{1,2}, "thingy", 3 }
would render as:
[[bob, jim], [1, 2], thingy, 3]
I've completed an initial implementation of this locally but I thought I'd check to see whether you think this is useful to include in the product and if you have any suggestions for modifications before raising a PR.
The text was updated successfully, but these errors were encountered: