-
Notifications
You must be signed in to change notification settings - Fork 808
Update deployment() return type signature to add conditional metadata property
#18468
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
base: main
Are you sure you want to change the base?
Conversation
|
Test this change out locally with the following install scripts (Action run 19375489829) VSCode
Azure CLI
|
Dotnet Test Results 102 files - 51 102 suites - 51 39m 52s ⏱️ - 43m 7s Results for commit 364708f. ± Comparison against base commit 2f3624a. This pull request removes 1954 and adds 662 tests. Note that renamed tests count towards both. |
There was a problem hiding this 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 updates the deployment() function's return type signature to conditionally include a metadata property in the template object when metadata declarations are present in the Bicep file. This allows users to access metadata values (like name, description, version) at deployment time through deployment().properties.template.metadata.<propertyName>.
- Replaced static
GetDeploymentReturnTypewith dynamicGetDeploymentReturnResultto enable runtime inspection of metadata declarations - Consolidated separate deployment function overloads for different scopes into a single unified overload
- Added conditional
metadataproperty to template return type based on presence of metadata declarations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Bicep.Core/Semantics/Namespaces/AzNamespaceType.cs | Refactored deployment() function to dynamically build return type with conditional metadata property based on semantic model, and consolidated scope-specific overloads into single unified implementation |
| src/Bicep.Core.IntegrationTests/ScenarioTests.cs | Added integration test verifying metadata properties can be accessed through deployment().properties.template.metadata |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Resolves #17555
Microsoft Reviewers: Open in CodeFlow