Skip to content

Commit 50f9908

Browse files
authored
Merge pull request #185 from michaeltlombardi/maint/main/document-dependsOn-update
Document `dependsOn` update
2 parents 415d60e + e1b30f9 commit 50f9908

File tree

36 files changed

+318
-291
lines changed

36 files changed

+318
-291
lines changed

docs/reference/cli/dsc.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,10 @@ To set the output format for a command or subcommand, specify this option before
7373
`dsc --format pretty-json resource list`.
7474

7575
```yaml
76-
Type: String
77-
Mandatory: false
78-
Default Value: yaml
79-
Valid Values:
80-
- json
81-
- pretty-json
82-
- yaml
76+
Type: String
77+
Mandatory: false
78+
DefaultValue: yaml
79+
ValidValues: [json, pretty-json, yaml]
8380
```
8481
8582
### -h, --help

docs/reference/cli/schema/command.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,19 @@ schema the application returns:
7373
`dsc config test` command.
7474

7575
```yaml
76-
Type: String
77-
Mandatory: true
78-
Valid Values:
79-
- dsc-resource
80-
- resource-manifest
81-
- get-result
82-
- set-result
83-
- test-result
84-
- configuration
85-
- configuration-get-result
86-
- configuration-set-result
87-
- configuration-test-result
76+
Type: String
77+
Mandatory: true
78+
ValidValues: [
79+
dsc-resource,
80+
resource-manifest,
81+
get-result,
82+
set-result,
83+
test-result,
84+
configuration,
85+
configuration-get-result,
86+
configuration-set-result,
87+
configuration-test-result
88+
]
8889
```
8990

9091
### -h, --help

docs/reference/schemas/config/document.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ The YAML or JSON file that defines a DSC Configuration.
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
19-
Type : object
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
19+
Type: object
2020
```
2121
2222
## Description
@@ -55,11 +55,12 @@ adheres to. DSC uses this property when validating the configuration document be
5555
configuration operations.
5656

5757
```yaml
58-
Type: string
59-
Required: true
60-
Format: URI
61-
Valid Values:
62-
- https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
58+
Type: string
59+
Required: true
60+
Format: URI
61+
ValidValues: [
62+
https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
63+
]
6364
```
6465

6566
### metadata
@@ -90,9 +91,9 @@ For more information about defining parameters in a configuration, see
9091
[DSC Configuration parameters][03] -->
9192

9293
```yaml
93-
Type: object
94-
Required: false
95-
Valid Property Schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.parameter.json
94+
Type: object
95+
Required: false
96+
ValidPropertySchema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.parameter.json
9697
```
9798

9899
### variables
@@ -125,10 +126,10 @@ For more information about defining a valid resource instance in a configuration
125126
[DSC Configuration resources][06] and [DSC Configuration resource groups][07]. -->
126127

127128
```yaml
128-
Type: array
129-
Required: true
130-
Minimum Item Count: 1
131-
Valid Item Schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.resource.json
129+
Type: array
130+
Required: true
131+
MinimumItemCount: 1
132+
ValidItemSchema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.resource.json
132133
```
133134

134135
<!-- [01]: ../../../configurations/overview.md -->

docs/reference/schemas/config/parameter.md

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Defines runtime options for a configuration.
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.parameter.json
19-
Type : object
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.parameter.json
19+
Type: object
2020
```
2121
2222
## Description
@@ -75,16 +75,9 @@ For more information about data types, see
7575
[DSC configuration parameter data type schema reference][02].
7676

7777
```yaml
78-
Type: string
79-
Required: true
80-
Valid Values:
81-
- string
82-
- securestring
83-
- int
84-
- bool
85-
- object
86-
- secureobject
87-
- array
78+
Type: string
79+
Required: true
80+
ValidValues: [string, securestring, int, bool, object, secureobject, array]
8881
```
8982

9083
### defaultValue
@@ -95,13 +88,8 @@ runtime and no default value is defined, DSC raises an error. The value must be
9588
parameter's `type`.
9689

9790
```yaml
98-
Required: false
99-
Valid JSON Types:
100-
- string
101-
- integer
102-
- object
103-
- array
104-
- boolean
91+
Required: false
92+
ValidJSONTypes: [string, integer, object, array, boolean]
10593
```
10694

10795
### allowedValues
@@ -114,14 +102,9 @@ This property is always an array. If this property is defined, it must include a
114102
the list of values.
115103

116104
```yaml
117-
Type: array
118-
Required: false
119-
Valid Item JSON Types:
120-
- string
121-
- integer
122-
- object
123-
- array
124-
- boolean
105+
Type: array
106+
Required: false
107+
ValidItemJSONTypes: [string, integer, object, array, boolean]
125108
```
126109

127110
### minLength
@@ -137,9 +120,9 @@ If this property is defined with the `maxLength` property, this property must be
137120
`maxLength`. If it isn't, DSC raises an error.
138121

139122
```yaml
140-
Type: int
141-
Required: false
142-
Minimum Value: 0
123+
Type: int
124+
Required: false
125+
MinimumValue: 0
143126
```
144127

145128
### maxLength
@@ -155,9 +138,9 @@ If this property is defined with the `minLength` property, this property must be
155138
`minLength`. If it isn't, DSC raises an error.
156139

157140
```yaml
158-
Type: int
159-
Required: false
160-
Minimum Value: 0
141+
Type: int
142+
Required: false
143+
MinimumValue: 0
161144
```
162145

163146
### minValue

docs/reference/schemas/config/resource.md

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Defines a DSC Resource instance in a configuration document.
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.resource.json
19-
Type : object
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.resource.json
19+
Type: object
2020
```
2121
2222
## Description
@@ -45,9 +45,13 @@ The `name` property of a resource instance defines the short, human-readable nam
4545
Resource instance. This property must be unique within a DSC Configuration document. If any
4646
resource instances share the same name, DSC raises an error.
4747

48+
The instance name must be a non-empty string containing only letters, numbers, and spaces.
49+
4850
```yaml
49-
Type: string
50-
Required: true
51+
Type: string
52+
Required: true
53+
MinimumLength: 1
54+
Pattern: ^[a-zA-Z0-9 ]+$
5155
```
5256

5357
### type
@@ -80,30 +84,62 @@ Required: true
8084
To declare that a resource instance is dependent on another instance in the configuration, define
8185
the `dependsOn` property.
8286

83-
This property must be an array of dependency declarations. Each dependency must use this
84-
syntax:
87+
This property defines a list of DSC Resource instances that DSC must successfully process before
88+
processing this instance. Each value for this property must be the `resourceID()` lookup for
89+
another instance in the configuration. Multiple instances can depend on the same instance, but
90+
every dependency for an instance must be unique in that instance's `dependsOn` property.
91+
92+
The `resourceID()` function uses this syntax:
8593

8694
```yaml
87-
"[<resource-type-name>]<instance-name>"
95+
"[resourceId('<resource-type-name>', '<instance-name>']"
8896
```
8997

90-
In the dependency syntax, `<resource-type-name>` is the `type` property of the dependent resource
91-
and `<instance-name>` is the dependency's `name` property.
98+
The `<resource-type-name>` value is the `type` property of the dependent resource and
99+
`<instance-name>` is the dependency's `name` property. When adding a dependency in a YAML-format
100+
configuration document, always wrap the `resourceID()` lookup in double quotes (`"`).
101+
102+
For example, this instance depends on an instance of the `Microsoft.Windows/Registry`
103+
resource named `Tailspin Key`:
104+
105+
```yaml
106+
- name: Tailspin Key
107+
type: Microsoft.Windows/Registry
108+
properties:
109+
keyPath: HKCU\tailspin
110+
_ensure: Present
111+
- name: Update Tailspin Automatically
112+
type: Microsoft.Windows/Registry
113+
properties:
114+
keyPath: HKCU\tailspin\updates
115+
valueName: automatic
116+
valueData:
117+
String: enable
118+
dependsOn:
119+
- "[resourceId('Microsoft.Windows/Registry', 'Tailspin Key')]"
120+
```
92121

93-
Multiple instances can depend on the same instance, but every dependency for an instance must be
94-
unique in that instance's `dependsOn` property.
122+
> [!NOTE]
123+
> When defining dependencies for [nested resource instances][02], instances can only reference
124+
> dependencies in the same resource provider or group instance. They can't use the `resourceId()`
125+
> function to lookup instances at the top-level of the configuration document or inside another
126+
> provider or group instance.
127+
>
128+
> If a top-level instance depends on a nested instance, use the `resourceId()` function to lookup
129+
> the instance of the provider or group containing the dependency instance instead.
95130

96131
<!-- For more information, see [Configuration resource dependencies][04]. -->
97132

98133
```yaml
99-
Type: array
100-
Required: false
101-
Items Must be Unique: true
102-
Valid Items Type: string
103-
Valid Items Pattern: ^\[\w+(\.\w+){0,2}\/\w+\].+$
134+
Type: array
135+
Required: false
136+
ItemsMustBeUnique: true
137+
ItemsType: string
138+
ItemsPattern: ^\[resourceId\(\s*'\w+(\.\w+){0,2}\/\w+'\s*,\s*'[a-zA-Z0-9 ]+'\s*\)\]$
104139
```
105140

106141
[01]: ../definitions/resourceType.md
142+
[02]: /powershell/dsc/glossary#nested-resource-instance
107143
<!-- [02]: ../../../resources/concepts/assertion-resources.md -->
108144
<!-- [03]: ../../../resources/concepts/schemas.md -->
109145
<!-- [04]: ../../../configurations/concepts/dependencies.md -->

docs/reference/schemas/definitions/message.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ A message emitted by a DSC Resource with associated metadata.
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/definitions/message.json
19-
Type : object
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/definitions/message.json
19+
Type: object
2020
```
2121
2222
## Description
@@ -67,12 +67,9 @@ Required: true
6767
Indicates the severity of the message.
6868
6969
```yaml
70-
Type: string
71-
Required: true
72-
Valid Values:
73-
- Error
74-
- Warning
75-
- Information
70+
Type: string
71+
Required: true
72+
Valid Values: [Error, Warning, Information]
7673
```
7774
7875
[01]: resourceType.md

docs/reference/schemas/definitions/parameters/dataTypes.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@ Defines valid data types for a DSC configuration parameter
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/definitions/parameters/dataTypes.json
19-
Type : string
20-
Valid Values:
21-
- array
22-
- bool
23-
- int
24-
- object
25-
- string
26-
- secureobject
27-
- securestring
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/definitions/parameters/dataTypes.json
19+
Type: string
20+
ValidValues: [array, bool, int, object, string, secureobject, securestring]
2821
```
2922
3023
## Description

docs/reference/schemas/definitions/resourceType.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Identifies a DSC Resource.
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/definitions/resourceType.json
19-
Type : string
20-
Pattern : ^\w+(\.\w+){0,2}\/\w+$
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/definitions/resourceType.json
19+
Type: string
20+
Pattern: ^\w+(\.\w+){0,2}\/\w+$
2121
```
2222
2323
## Description

docs/reference/schemas/outputs/config/get.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ The result output from the `dsc config get` command.
1414
## Metadata
1515

1616
```yaml
17-
Schema Dialect : https://json-schema.org/draft/2020-12/schema
18-
Schema ID : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/outputs/config/get.json
19-
Type : object
17+
SchemaDialect: https://json-schema.org/draft/2020-12/schema
18+
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/outputs/config/get.json
19+
Type: object
2020
```
2121
2222
## Description
@@ -41,9 +41,9 @@ configuration document. Every entry in the list includes the resource's type nam
4141
and the result data for an instance.
4242

4343
```yaml
44-
Type: array
45-
Required: true
46-
Items Type: object
44+
Type: array
45+
Required: true
46+
ItemsType: object
4747
```
4848

4949
#### type

0 commit comments

Comments
 (0)