BCPNFR17 - Code Styling - Type casting
To improve the usability of primitive module properties declared as strings, you SHOULD declare them using a type which better represents them, and apply any required casting in the module on behalf of the user.
For reference, please refer to the following examples:
@allowed([
'false'
'true'
])
param myParameterValue string = 'false'
resource myResource '(...)' = {
(...)
properties: {
myParameter: myParameterValue
}
}
param myParameterValue string = false
resource myResource '(...)' = {
(...)
properties: {
myParameter: string(myParameterValue)
}
}
@allowed([
'1'
'2'
'3'
])
param zones array
resource myResource '(...)' = {
(...)
properties: {
zones: zones
}
}
@allowed([
1
2
3
])
param zones int[]
resource myResource '(...)' = {
(...)
properties: {
zones: map(zones, zone => string(zone))
}
}