Azure / Azure/bicep

User-defined types -How to define default value

Open
#9,636 17 comments 10 reactions 0 assignees View on GitHub
enhancement Needs: Upvote type system
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.**
We can define the following type:

```bicep
type test = {
foo: true
}
```
But when you use intellisense on the foo property you get:
![image](https://user-images.githubusercontent.com/11890856/214564569-f3ab2423-f05c-4bca-ac94-3515755910fa.png)
Instead what I want to get is that foo is boolean and default value is true.

What if I also want to define default value that uses Bicep function like:

```bicep
type test = {
foo: subscription().subscriptionId
}
```

**Describe the solution you'd like**
See above.

Contributor guide

Open the contributing guide

Research direction

No implementation files or tests are named. Start by reviewing the user-defined type examples and the IntelliSense behavior described in the issue, then determine how literal and function-based defaults should be represented. Done means the editor reports both the property type and its default value consistently for the shown examples.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.