Incorrect severity and message for invalid UDT parameter in extended bicepparam file
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.44.1 (28275db947)
**Describe the bug**
When using the new extendable `.bicepparam` feature together with a parameter that is typed using a user-defined type (UDT), the diagnostics shown for invalid inherited parameter values is a bit misleading.
In my example, the main Bicep file defines a parameter `parPerson` of type `personType`. The base parameter file deliberately assigns an object to `parPerson` that does not match the UDT contract.
Instead of showing a clear error on the incorrect property in the base parameter file, the main parameter file reports that the `param` keyword is missing:
Additionally, the `main.bicepparam` file uses `using './main.bicep'` and `extends './base.bicepparam'`, the diagnostic shown on the inherited base value appears as a warning instead of an error:
**To Reproduce**
Create the following files:
main.bicep:
```bicep
param parName string
param parAge int
param parAddress string
param parPerson personType
type personType = {
name: string
age: int
address: string
}
output name string = parName
output age int = parAge
output address string = parAddress
output person personType = parPerson
```
main.bicepparam:
```bicep
using './main.bicep'
extends './base.bicepparam'
param parAddress = 'a'
param parAge = 26
param parName = 'c'
```
base.bicepparam:
```bicep
using none
param parPerson = {
test: 'testing'
}
```
**Additional context**
This behaviour is confusing for the user because it's harder to understand where the issue is. In this small example its easy to spot the problem, but in larger templates it's harder. Especially when there is no UDT autocompletion available in the `base.bicepparam` (extended bicepparam). Additionally, there's no validation on the bicepparam file that is being extended.
Contributor guide
Assessment
This issue has not been assessed yet.