Azure / Azure/bicep

`@validate()` decorator should support multi-line lambda expressions

Open
#18,168 0 comments 2 reactions 0 assignees View on GitHub
enhancement
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.**

In the [request for enhancement](https://github.com/Azure/bicep-reps/blob/790a3ab7b6ae8a1c1fff2097ac34719d60a16f0a/active/0010-custom-validation-decorators.md#client-side-changes), there's an example provided by Jonny on a multi-line lambda expression on the `@validate()` decorator:

```bicep
@validate(
x => startsWith(x, 'fo'), 'baz must start with the letters \'fo\'',
x => endsWith(x, 'd'), 'baz must end with the letter \'d\'',
x => length(x) == 4, 'baz be exactly 4 letters')
param baz string
```

Now, using the latest version (v0.38.5), multi-line support is not available.

Image

**Describe the solution you'd like**

Allow multi-line lambda expression for the `@validate()` decorator.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the multi-line @validate() example from the issue on Bicep v0.38.5 and trace how lambda expressions in decorators are parsed. The work is done when the shown decorator with multiple lines is accepted and existing single-line validation behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.