Skip to content

Commit 40d6a6b

Browse files
committed
Update with Copilot remarks
1 parent d70b0de commit 40d6a6b

4 files changed

Lines changed: 25 additions & 21 deletions

File tree

docs/reference/schemas/config/functions/contains.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Reference for the 'contains' DSC configuration document function
3-
ms.date: 08/08/2025
3+
ms.date: 09/01/2026
44
ms.topic: reference
55
title: contains
66
---
@@ -23,11 +23,14 @@ contains(<collection>, <value>)
2323
The `contains()` function checks whether a collection (array, object, or
2424
string) contains a specific value, returning `true` if it does and `false`
2525
otherwise. For arrays, it checks if the value exists as an element. For
26-
objects, it checks if the value exists as a property key or value. For
27-
strings, it checks if the value exists as a substring.
26+
objects, it checks if the value exists as a property key. The function
27+
doesn't check object property values. For strings, it checks if the value
28+
exists as a substring.
2829

2930
The function accepts string and number values for the search parameter when
30-
used with arrays, objects, or strings.
31+
used with arrays, objects, or strings. When the search value is a number and
32+
the collection is an object or a string, DSC compares the number by its
33+
string representation.
3134

3235
## Examples
3336

@@ -76,10 +79,12 @@ messages: []
7679
hadErrors: false
7780
```
7881
79-
### Example 2 - Check object for keys and values
82+
### Example 2 - Check object for keys
8083
81-
The following example shows how to check if an object contains specific keys
82-
or values.
84+
The following example shows how to check if an object contains specific keys.
85+
For objects, `contains()` only checks keys, not property values. To check the
86+
contents of a property value, access the property and check it as a string,
87+
like the `cityHasSeattle` output in this example.
8388

8489
```yaml
8590
# contains.example.2.dsc.config.yaml
@@ -96,10 +101,10 @@ resources:
96101
type: Microsoft.DSC.Debug/Echo
97102
properties:
98103
output:
99-
hasNameKey: "[contains(parameters('myObject'), 'name')]"
100-
hasEmailKey: "[contains(parameters('myObject'), 'email')]"
101-
hasSeattleValue: "[contains(parameters('myObject').city, 'Seattle')]"
102-
hasAge30Value: "[contains(parameters('myObject').age, 30)]"
104+
hasNameKey: "[contains(parameters('myObject'), 'name')]"
105+
hasEmailKey: "[contains(parameters('myObject'), 'email')]"
106+
hasAgeKey: "[contains(parameters('myObject'), 'age')]"
107+
cityHasSeattle: "[contains(parameters('myObject').city, 'Seattle')]"
103108
```
104109

105110
```bash
@@ -115,8 +120,8 @@ results:
115120
output:
116121
hasNameKey: true
117122
hasEmailKey: false
118-
hasSeattleValue: true
119-
hasAge30Value: true
123+
hasAgeKey: true
124+
cityHasSeattle: true
120125
messages: []
121126
hadErrors: false
122127
```

docs/reference/schemas/config/functions/dataUri.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ dataUri(<stringToConvert>)
2020
## Description
2121

2222
The `dataUri()` function converts a string value to a [data URI][01] format. The function encodes
23-
the input string as base64 and returns it as a data URI with the `application/json` media type and
24-
`utf8` charset.
23+
the input string as base64 and returns it as a data URI with the `application/json` media type.
2524

2625
Data URIs are useful for embedding small text content directly in configuration documents,
2726
especially when the content needs to be passed through systems that expect URI-formatted data.
@@ -179,8 +178,8 @@ MaximumCount: 1
179178
## Output
180179

181180
The `dataUri()` function returns a data URI string in the format
182-
`data:application/json;charset=utf8;base64,<encoded-content>` where `<encoded-content>` is the
183-
base64 representation of the **stringToConvert** value.
181+
`data:application/json;base64,<encoded-content>` where `<encoded-content>` is the base64
182+
representation of the **stringToConvert** value.
184183

185184
```yaml
186185
Type: string

docs/reference/schemas/config/functions/systemRoot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ hadErrors: false
8484

8585
## Output
8686

87-
The `systemRoot()` function returns the system root of the current host, or the value overriden
87+
The `systemRoot()` function returns the system root of the current host, or the value overridden
8888
using the [`--system-root` command line flag][01].
8989

90-
This is usually `C:\` on Windows system and `/` on Unix systems.
90+
This is usually `C:\` on Windows systems and `/` on Unix systems.
9191

9292
```yaml
9393
Type: string

lib/dsc-lib/src/parser/functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub enum FunctionArg {
4343
///
4444
/// Lambdas are created using the `lambda()` function syntax:
4545
/// ```text
46-
/// "[lambda(['item', 'index'], mul(variables('item'), 2))]"
46+
/// "[lambda('item', 'index', mul(lambdaVariables('item'), 2))]"
4747
/// ```
4848
///
4949
/// The lambda is stored in the context and referenced by UUID:
@@ -53,7 +53,7 @@ pub enum FunctionArg {
5353
///
5454
/// When used with `map()`, the lambda is invoked for each array element with bound parameters:
5555
/// ```text
56-
/// "[map(createArray(1, 2, 3), lambda(['item'], mul(variables('item'), 2)))]"
56+
/// "[map(createArray(1, 2, 3), lambda('item', mul(lambdaVariables('item'), 2)))]"
5757
/// ```
5858
///
5959
/// # Lifetime

0 commit comments

Comments
 (0)