Skip to content

Incorrect severity and message for invalid UDT parameter in extended bicepparam file #19982

Description

@johnlokerse

Bicep version
Bicep CLI version 0.44.1 (28275db)

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:

Image

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:

Image

To Reproduce

Create the following files:

main.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:

using './main.bicep'
extends './base.bicepparam'

param parAddress = 'a'
param parAge = 26
param parName = 'c'

base.bicepparam:

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions