Skip to content

Conversation

@ArcturusZhang
Copy link
Member

@ArcturusZhang ArcturusZhang commented Sep 22, 2025

Fixes #51371
Fixes #48491
Fixes #52263
Fixes #53346

This PR introduces a new API:

namespace Azure.Provisioning;

public static class BicepValueExtensions
{
    public static BicepExpression ToBicepExpression(this IBicepValue bicepValue) {}
}

which allows you to convert any IBicepValue instance into an expression representing its hierarchy.

Remaining items:

  • Output list/dictionary should compile into expressions like output properties do.
  • Add examples and notes for this new API in the Readme.md

@github-actions
Copy link

github-actions bot commented Sep 22, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

Azure.Provisioning

@ArcturusZhang

This comment was marked as outdated.

@ArcturusZhang ArcturusZhang force-pushed the bicep-value-expression-builder branch from df242c0 to be423ba Compare September 23, 2025 08:22
@ArcturusZhang ArcturusZhang marked this pull request as ready for review September 23, 2025 08:24
Copilot AI review requested due to automatic review settings September 23, 2025 08:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a Bicep reference builder that enhances the Azure Provisioning library by enabling proper resolution of property references within Bicep expressions. The changes establish a system for tracking and building references to nested properties, lists, and dictionaries, allowing for more robust expression generation and interpolation capabilities.

Key changes:

  • Added ToBicepExpression() extension method for converting BicepValue instances to their expression representations
  • Implemented specialized reference classes for list and dictionary indexing operations
  • Enhanced collection classes to maintain proper self-references for nested items

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
BicepValueToExpressionTests.cs Comprehensive test suite covering literal values, property references, collections, and interpolation scenarios
BicepValueHelpers.cs Utility class providing helper methods for setting self-references on BicepValue instances
ProvisionableConstruct.cs Simplified construct compilation by delegating to CompileProperties method
BicepValueReference.cs Enhanced with specialized subclasses for list and dictionary indexing operations
BicepTypeMapping.cs Updated type mapping to handle AzureLocation and ResourceType, improved construct compilation
BicepValueOfT.cs Refactored value storage to support lazy evaluation via value factories
BicepValue.cs Added utility import for helper methods
BicepListOfT.cs Enhanced collection management with proper self-reference tracking for items
BicepExpressionExtensions.cs New extension method for converting BicepValue instances to expressions
BicepDictionaryOfT.cs Enhanced dictionary operations with self-reference management for values
Azure.Provisioning.netstandard2.0.cs API surface update adding BicepExpressionExtensions
Azure.Provisioning.net8.0.cs API surface update adding BicepExpressionExtensions

@ArcturusZhang

This comment was marked as outdated.

@ArcturusZhang ArcturusZhang requested a review from Copilot October 16, 2025 02:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

@ArcturusZhang ArcturusZhang requested a review from Copilot October 31, 2025 08:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

sdk/provisioning/Azure.Provisioning/src/BicepDictionaryOfT.cs:1

  • [nitpick] The condition values != null is repeated twice. Consider storing the result in a local variable or using a null-coalescing pattern to avoid redundancy and improve readability.
// Copyright (c) Microsoft Corporation. All rights reserved.

@ArcturusZhang ArcturusZhang merged commit b69320c into Azure:main Nov 11, 2025
17 checks passed
@ArcturusZhang ArcturusZhang deleted the bicep-value-expression-builder branch November 11, 2025 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants