-
Notifications
You must be signed in to change notification settings - Fork 47
Add contains()
, union()
, length()
, and empty()
Array functions
#1005
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
Conversation
28cdd09
to
bc5e1ae
Compare
Looks like |
contains()
and union()
Array functionscontains()
, union()
, length()
, and empty()
Array functions
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.
Pull Request Overview
This PR adds four new array functions to the DSC library: contains()
, union()
, length()
, and empty()
, which check for element existence, combine arrays/objects, return sizes, and check for emptiness respectively.
- Implementation of four new DSC array functions with comprehensive test coverage
- Registration of functions in the function dispatcher
- Addition of localized strings for error messages and descriptions
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
dsc_lib/src/functions/union.rs | Implements union function for merging arrays and objects |
dsc_lib/src/functions/length.rs | Implements length function for arrays, objects, and strings |
dsc_lib/src/functions/empty.rs | Implements empty function to check if collections are empty |
dsc_lib/src/functions/contains.rs | Implements contains function for searching in collections |
dsc_lib/src/functions/mod.rs | Registers the new functions in the function dispatcher |
dsc_lib/locales/en-us.toml | Adds localized strings for the new functions |
dsc/tests/dsc_functions.tests.ps1 | Adds comprehensive test cases for all new functions |
Comments suppressed due to low confidence (3)
dsc_lib/src/functions/contains.rs:98
- Use
Value::Bool(true)
instead oftrue
for consistent type comparison in tests, matching the actual return type of the function.
assert_eq!(result, true);
dsc_lib/src/functions/contains.rs:105
- Use
Value::Bool(false)
instead offalse
for consistent type comparison in tests, matching the actual return type of the function.
assert_eq!(result, false);
dsc_lib/src/functions/contains.rs:112
- Use
Value::Bool(true)
instead oftrue
for consistent type comparison in tests, matching the actual return type of the function.
assert_eq!(result, true);
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
9f3c431
to
3001dad
Compare
PR Summary
Add
contains()
,union()
,length()
, andempty()
array functionsI would suggest using the ARM docs for describing the behaviors which isn't completely obvious:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-array#contains
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-array#union
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-array#length
https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-array#empty
PR Context
Part of #976