Request for better Parameter validation #9797
-
There's a great article covering Parameters in Bicep which (at the time of writing) covers how decorators can be used to specify constraints for things like minLength and maxLength, to defend against invalid values. Maybe it's just me; but most of the things that I'm having to declare as parameters are the names of things. Whenever I am entering a name through the portal, if I enter something which breaks the rules, it pops up a little warning, typically saying something like:
So my initial thought was that it would be really nice if there was a Regex-style decorator that I could use to validate against that definition. And to be fair, that might be a useful addition to have anyway. But then I thought about it... there are loads of different naming rules, for different things; and (if I can be honest), I really don't want my bicep scripts to contain the actual definitions of the naming rules - aside from anything else, they would potentially get out of date, and I would have to trawl through the files updating all the Regexes. What I'd really like is to be able to reference a naming rule by referring to a versioned resource type, for example, like where I might refer to a For example:
And the Regex validator would probably be nice as well, albeit completely separate from this :). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Work on this feature is being tracked in #9229. Regular expression validators are also being worked on (tracked in #8409). |
Beta Was this translation helpful? Give feedback.
-
Thanks @jeskew, it's good to see the Regex validator has been independently requested in #8409, so I can forget about that. I'll take a look at #9229. |
Beta Was this translation helpful? Give feedback.
Work on this feature is being tracked in #9229. Regular expression validators are also being worked on (tracked in #8409).