Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure.Provisioning: Avoid excess nulls in BicepStringBuilder #46742

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,12 @@ await test.Define(
infra.Add(new ProvisioningOutput("blobs_endpoint", typeof(string)) { Value = storage.PrimaryEndpoints.Value!.BlobUri });

// Manually compute the public Azure endpoint
string? nothing = null;
BicepValue<string> computed =
new BicepStringBuilder()
.Append("https://")
.Append($"{storage.Name}")
.Append(".blob.core.windows.net");
.Append($".blob.core.windows.net{nothing}");
infra.Add(new ProvisioningOutput("computed_endpoint", typeof(string)) { Value = computed });

return infra;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ public void AppendFormatted<T>(T t)
}
else
{
_expressions.Add(
t is null ?
BicepSyntax.Null() :
tg-msft marked this conversation as resolved.
Show resolved Hide resolved
BicepSyntax.Value(t.ToString() ?? ""));
string? s = t?.ToString();
if (s is not null)
{
_expressions.Add(BicepSyntax.Value(s));
}
}
}

Expand Down