The error message on PasteAsBicep failure provided an invalid ARM JSON template is not informative
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
### Expected Behavior
The error message should be sufficiently informative for the user to know how to fix the issue, at this time its somewhat cryptic. I would expect it to provide clear details about what is not valid so that I can fix it.
Does this occur consistently? Yes
Repro steps:
1. Copy the ARM JSON to the clipboard
2. Trigger PasteAsBicep command from the right click context menu
Action: command/bicep.pasteAsBicep
Error type: Error
Error Message: Could not paste clipboard text as Bicep: [redacted:id]: Unable to locate 'type' for parameter 'PrivateEndpointDnsGroupName'
Version: 0.38.33
OS: win32
OS Release: 10.0.26200
Product: Visual Studio Code - Insiders
Product Version: 1.106.0-insider
Language: en
Call Stack
```
PasteAsBicepCommand.execute pasteAsBicep.ts:108:15
commandManager.ts:56:55commandManager.ts:56:55
```
clipboardText
```
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"privateZoneName": {
"type": "string"
},
"PrivateEndpointDnsGroupName": {
"value": "string"
},
"privateEndpointName":{
"value": "string"
}
},
"resources": [
{
"type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups",
"apiVersion": "2020-06-01",
"name": "[concat(parameters('privateEndpointName'), '/', parameters('PrivateEndpointDnsGroupName'))]",
"location": "global",
"dependsOn": [
"[resourceId('Microsoft.Network/privateDnsZones', parameters('privateZoneName'))]",
"[variables('privateEndpointName')]"
],
"properties": {
"privateDnsZoneConfigs": [
{
"name": "config1",
"properties": {
"privateDnsZoneId": "[resourceId('Microsoft.Network/privateDnsZones', parameters('privateZoneName'))]"
}
}
]
}
}
]
}
```
Contributor guide
Research direction
The failure is surfaced at pasteAsBicep.ts:108:15; start there and reproduce it with the clipboard ARM JSON shown in the report. Trace the conversion error so the PasteAsBicep message explains which template value is invalid and how to correct it, then verify the wording against the same reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100