Conversation
|
Test this change out locally with the following install scripts (Action run 21681584810) VSCode
Azure CLI
|
| ("main.bicep", new(""" | ||
| extension '../extension.tgz' as ext | ||
| var foo = ext.config('redis') | ||
| """)), |
There was a problem hiding this comment.
[Nit]: With """ blocks, multiline snippets don't have to be flush with the left margin. I try to keep them bounded by one indentation level past the line they appear in, but opinions on what's most readable vary.
| // Ideally extension namespace function authors shouldn't need to set this flag in the types.json at all if they have externalInputs in the "evaluatesTo" property | ||
| // Consider using visitor pattern to determine this automatically | ||
| if (!functionSymbol.FunctionFlags.HasFlag(FunctionFlags.RequiresExternalInput)) | ||
| catch (Exception) |
There was a problem hiding this comment.
Is there any way to make this more specific? What exceptions are expected here?
There was a problem hiding this comment.
Added handling and unit test for ExpressionException if there is a failure running the arm expression evaluator.
| if (intermediate is not FunctionCallExpression functionExpression || functionExpression.Parameters.Length < 1) | ||
| private void CollectExternalInputs(FunctionCallSyntaxBase sourceSyntax, FunctionExpression functionExpression) | ||
| { | ||
| if (!functionExpression.NameEquals(LanguageConstants.ExternalInputBicepFunctionName)) |
There was a problem hiding this comment.
Yes, it's case-insensitive.
bicep/src/Bicep.Core/Extensions/LanguageExpressionExtensions.cs
Lines 9 to 10 in c378ace
There was a problem hiding this comment.
Could you add a couple of tests here? I think there should be tests covering:
- The result of one namespace function being passed as an argument to another.
- A namespace function where
externalInputis part of a function property
c378ace to
4f6e5df
Compare
4f6e5df to
249ba06
Compare
Description
LanguageExpression. This is because the extension namespace function may define the expression that it should be reduced to which may not necessarily be the same as the function syntax.Example Usage
Namespace function definition:
Bicepparam:
Compiled json:
Checklist
Microsoft Reviewers: Open in CodeFlow