Azure / Azure/bicep

Allow usage of bicep code in decorators

Open
#11,977 8 comments 2 reactions 0 assignees View on GitHub
enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
I have the following example:

main.bicep
```bicep
var defaultValue: {
test: 'foo1'
}

type foo = {
@description('Some description. Default value: ${defaultValue.test}')
property1: 'foo1' | 'foo2'?
}

param foo foo
```

As you see in VSC the description does not work. That happens when you use bicep code inside description decorator. VSC does not throw any errors on main.bicep so it is expected this to work but in reality it does not.

![image](https://github.com/Azure/bicep/assets/11890856/dc1e1ca6-4a3a-4203-81b7-3361eda29b33)

The scenario here is that I just want to reference those default values as that way I can only have them in once place and upon changing I do not have to change them on multiple times. This is also useful when you have some content that is saved in text files like Kusto queries for which you can just reference that text file instead of adding the whole query all over again.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior from the main.bicep example in VSC, focusing on the decorator description that references defaultValue.test. Determine how decorator descriptions currently handle Bicep expressions; done means the referenced value appears in the description without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.