Null values are being stripped from the result of Bicep Local Extension deployments.
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.39.261 (477006726d)
Built from source with nightly vscode extensions
**Describe the bug**
Null values are being stripped from the result of Bicep Local Extension deployments.
**To Reproduce**
Create a Local Extension with a nullable read-only type property. And use it in the outputs of a template.
If the value remains null, when evaluating output parameters, it throws an error like this:
```
TRACE: JobWarning: operationName=DeploymentLastJob.ProcessTemplateOutputParameter, jobPartition=00000000000000000000000000000000, jobId=DeploymentJob:3A2DLOCAL:3A2D10C8A2CD:3A3A2D392D:3A3A2D4:7CA2BEAA249A852077-system:2Elast, message=Unable to process template output parameter 'existingName'., exception=Azure.Deployments.Core.Exceptions.ExpressionException: The language expression property 'output' doesn't exist, available properties are 'parameters, options, name, enableLogging, cleanupLogs, appendLogs'.
```
That is every property except `Output`, a nullable string that remained null.
**Additional context**
I don't believe this behavior is correct, the property still exists, the value is just null.
I *think* the property is being stripped by the ignore null behavior applied to the JsonSerializer in the ResourceHandler class.
Contributor guide
Research direction
Start by inspecting the ResourceHandler class and its JsonSerializer configuration, then reproduce the Local Extension deployment with a nullable read-only property used in template outputs. Done means a null property remains present in the deployment result and the output parameter no longer fails with the missing-property error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100