Add contains(), union(), length(), and empty() Array functions#1005
Merged
SteveL-MSFT merged 8 commits intoPowerShell:mainfrom Aug 5, 2025
Merged
Add contains(), union(), length(), and empty() Array functions#1005SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
contains(), union(), length(), and empty() Array functions#1005SteveL-MSFT merged 8 commits intoPowerShell:mainfrom
Conversation
28cdd09 to
bc5e1ae
Compare
Member
Author
|
Looks like |
contains() and union() Array functionscontains(), union(), length(), and empty() Array functions
Contributor
There was a problem hiding this comment.
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 oftruefor 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 offalsefor 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 oftruefor consistent type comparison in tests, matching the actual return type of the function.
assert_eq!(result, true);
tgauth
reviewed
Aug 5, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
9f3c431 to
3001dad
Compare
tgauth
approved these changes
Aug 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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