azure-functions-templates icon indicating copy to clipboard operation
azure-functions-templates copied to clipboard

Fix validation regexes

Open mathewc opened this issue 8 years ago • 4 comments

PR https://github.com/Azure/azure-webjobs-sdk/pull/1188 adds declarative regex validation for Table names, though the regexes no longer match. We need to get them into alignment for Table, and any of the others we move to the new declarative model.

mathewc avatar Jun 22 '17 04:06 mathewc

@soninaren created these template regexes I believe, so he may have more insights into their current form and whether the new one in the above referenced PR is correct.

mathewc avatar Jun 22 '17 04:06 mathewc

(Nit, #1188 doesn't add a new regex - this is the same regex we've had since v1.0; it just changes how it's invoked).

Here's the problem: In SDK: "^[A-Za-z][A-Za-z0-9]{2,62}$" In Bindings.json: "^[A-Za-z][A-Za-z0-9]{2,62}$|^[{][a-zA-Z0-9]{1,126}[}]$|^[%][a-zA-Z0-9]{1,126}[%]$",

The difference is just that bindings.json is appending additional patterns to support { } and %%.

The binding.json is applied on the raw user input, which still has { } and %% values. But the SDK regex expression is applied after the { } and %% substitution occurs, so it can be simpler.

That said, the { } %% substitution is more complex than described in bindings.json regex. For example, "table{x}{y}" is a legal expression but would be failed by bindings.json.

MikeStall avatar Jun 22 '17 16:06 MikeStall

This is related to https://github.com/Azure/azure-webjobs-sdk-script/issues/1416. We should have a single regex (now in SDK) and portal uses that.

MikeStall avatar Jun 22 '17 16:06 MikeStall

Moving out of sprint 6 since it needs a deeper discussion and possible update to portal and or runtime

soninaren avatar Jul 18 '17 22:07 soninaren