String functions for compile time
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Is your feature request related to a problem? Please describe.**
When working with bicep files and loading JSON/text content to be used as an input, we are performing some string replacement functions.
For example,
```
var customPolicies = string(loadJsonContent('../../inputs/policies.json'))
var customPoliciesModified1 = replace(customPolicies, "valueOld", "valueNew")
var customPoliciesModified = array(json(customPoliciesModified1))
```
Currently, this gets converted into ARM functions and increases the size of the deployment and with large JSONs and many replaces it hits ARM limit on string literals in ARM template expressions.
**Describe the solution you'd like**
A way to apply string functions at a compile time.
Contributor guide
Research direction
Start from the compile-time handling of string operations in the Bicep compiler and compare it with the loadJsonContent example in the issue. Determine how compile-time replacement and JSON conversion should appear in the generated ARM template, then validate that large inputs no longer expand into ARM string expressions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100