Skip to content

Commit b1b4263

Browse files
(SCHEMA) Update returnKind and associated properties
Prior to this change, the `returnKind` shared definition set a default value. This was inaccurate, because `set.return` has different behavior when `return` isn't defined - DSC invokes the **Get** operation to construct the result after the **Set** operation for the resource concludes. This change removes the default from the shared definition, adds it to the `test.return` property, and clarifies the behavior for the `set.return` property. Finally, this change also makes `whatIf.return` mandatory, as the synthetic after-state doesn't make sense for this operation, even if DSC will technically accept it.
1 parent 135837e commit b1b4263

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

schemas/src/definitions/returnKind.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ type: string
77
enum:
88
- state
99
- stateAndDiff
10-
default: state
1110

1211
$comment: |-
1312
While the enumeration for return kind is the same for the `set` and `test`

schemas/src/resource/manifest.set.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ properties:
179179
Defines whether the command returns a JSON blob of the DSC resource's state after the set
180180
operation or the state and an array of the properties the DSC resource modified.
181181
182+
When a manifest doesn't define `set.return`, DSC doesn't expect the resource to emit any
183+
JSON to stdout. Instead, DSC invokes the **Get** operation for the resource to construct
184+
the result object, retrieving the actual state of the resource after the **Set** operation.
185+
182186
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/set?<DOCS_VERSION_PIN>#return
183187
markdownEnumDescriptions:
184188
- | # state

schemas/src/resource/manifest.test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ properties:
133133
Defines whether the command returns a JSON blob of the DSC resource's current state or the
134134
state and an array of the properties that are out of the desired state.
135135
$ref: /<PREFIX>/<VERSION>/definitions/returnKind.yaml
136+
default: state
136137
# VS Code only
137138
markdownDescription: |
138139
***

schemas/src/resource/manifest.whatIf.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ markdownDescription: | # VS Code only
4040
type: object
4141
required:
4242
- executable
43+
- return
4344
properties:
4445
executable:
4546
$ref: /<PREFIX>/<VERSION>/definitions/commandExecutable.yaml
@@ -190,6 +191,15 @@ properties:
190191
set operation in what-if mode or the state and an array of the properties the DSC resource
191192
would modify.
192193
194+
Unlike the `set.return` property, you must specify a value for `whatIf.return` for the
195+
resource to function correctly. When you don't define `set.return` in your resource manifest,
196+
DSC invokes the **Get** operation on the resource after the **Set** operation to construct
197+
the result with the final state of the resource.
198+
199+
For what-if operations, the resource doesn't actually change the system, so invoking the
200+
**Get** operation after the what-if command executes will always show the final state to
201+
be the same as the before state.
202+
193203
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/whatif?<DOCS_VERSION_PIN>#return
194204
markdownEnumDescriptions:
195205
- | # state

0 commit comments

Comments
 (0)