Allow fail() function to be used outside of an assignment statement
- 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.**
Our Bicep allows developers to specify many parameters, but some parameter values are incompatible with each other. For example if "allowDocumentAccess" is true, then "enforceAccessControl" should also be true. We'd like to let developers know when they've specified an incompatible set of values.
There doesn't seem to be a way to call fail() at the global level, however, it can only be used in an expression. So this is what I've got working so far:
```
var foo = (enableGlobalDocuments && !enforceAccessControl) ? fail('Access control must be enforced if global document access is enabled.') : ''
```
It would be great if we could have that expression without having to store in a variable, or some other way of doing this, like the assert() idea.
Contributor guide
Research direction
The issue names no files, tests, or entry points. Start by examining how Bicep currently handles fail() within expressions, then determine the intended top-level form or assert alternative; done means incompatible parameter values can be reported without assigning the result to a variable.
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