Hi guys - I'm like a dog with a bone sometimes.. J...
# general
r
Hi guys - I'm like a dog with a bone sometimes.. Just experimenting... and i wondered.. ok so i can upload a folder full of arbitary files - fine - but what if i wanted to output and array of the Uri strings... so I am trying to create an [Output] of type Immutable Array. I've tried shoving all sorts into it.. now I am just trying static test to POC it.. but it still doesn't work.
[Output]
public Output<ImmutableArray<string>> UploadedUri { get; set; } = Output.Create(ImmutableArray.Create<string>("123"));
Any tips or pointers? how do i get an array of things? I've seen dictionary before.. but not list/array.
t
LGTM. What’s the error?
r
Stack trace about the types only being allow to be immutable types... I have further simplified it.. and I have some output... now i need to increase the complexity and have it return more than "123" 🙂
This is the stack trace - but I wouldn't worry about it as i am inching forward again now.
ok so i have experimented and gotten my list and dict of strings being output... the drama I have is i want my SourceUri from Blob in the array. I can't seem to access the underlying string in those Output<string> and when i try and create a list of Output<string> i get an error... any tips?
public Output<ImmutableArray<Output<string>>> UploadedUri { get; set; }
i am guessing that i want that to just be public Output<ImmutableArray<string>> UploadedUri { get; set; } - but to do that i need to get at the strings hidden behind uploadedFile.SourceUri;
I've achieved what i wanted to do by changing the types within my array from Output<string> to object? eg public Output<ImmutableArray<object?>> UploadedUri { get; set; } instead of public Output<ImmutableArray<Output<string>> UploadedUri { get; set; } Jonathh  [4:45 PM] it seems to be the way as the examples return dicts of <string, object?> - it is quite messy.... but works i guess
t
Output<ImmutableArray<Output<string>>
doesn’t sound right to me. You should be able to process whatever you have to
Output<ImmutableArray<string>>
. Flatten the output.
r
i can't get access to the string behind the outputs - is problem number one
so I have a Output<String> that i want to put into an array of strings. how do i get the string out?
the object? works btw.. it is just messy.
t
So I don’t have your code but this may help:
Copy code
Output<ImmutableArray<Output<string>>> notGood =
    Output.Create(new[] {Output.Create("1"), Output.Create("2")}.ToImmutableArray());
Output<ImmutableArray<string>> better = notGood.Apply(vs =>
     Output.All(vs.Select(v => (Input<string>)v).ToImmutableArray()));
It turns out that
Output.All
doesn’t accept outputs… We should probably add an overload for that.
r
thanks - i'll take a look at that.. the array of outputs does work.. but you have to 'mask' the inner outputs as objects if that makes sense
t
It just feels wrong to me 😉