New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support prompt and assign user-defined parameter types (bicep) #2793
Support prompt and assign user-defined parameter types (bicep) #2793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for jumping on this quickly to address the panic, @vhvb1989!
Code changes seem reasonable, but I would have much more confidence in my review if there was a test to go with this.
I do believe this will address the panic that the bug this fixes, addresses, but I'm sort of wondering if there are more problems lurking down the line. For example, if there's a required parameter and it is of a user defined type, are we going to panic when we go to prompt for it?
I suspect we need to think about how we prompt for user defined types. I'm fine with landing a half measure where we fix the panic now and if we need to prompt for a user defined type we just error and ask them to pass the value either via the .parameters.json
or .bicepparam
file.
Or if it all just works, great! Perhaps in that case we could add a small unit-test of that, as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test - a small piece of feedback on maybe not breaking compileBicep
apart into both a member function and a top level function in the package. I trust your judgement here so if there's some reason that won't work, feel free to keep what have you here.
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash:
pwsh:
WindowsPowerShell install
MSI install
Standalone Binary
MSIContainer
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
error not related to this PR |
/check-enforcer override |
fix: #2791
When a
user-defined type
is used in bicep, the parameter uses a$ref
field to redirect the parameters definition like:This PR adds the
$ref
field and theDefinitions
properties for the compile bicep abstraction output.Then, azd will loop the parameters from the template and apply its definition from the
Definitions
properties (or fail and return an error while it tries to do it).As a result, all user-defined types will be resolved as a combination of
type+allowedValues
description for a parameter. Azd will continue its regular flow after that.