update property names for JSON camel casing, add inDesiredState property#115
update property names for JSON camel casing, add inDesiredState property#115SteveL-MSFT merged 6 commits intoPowerShell:mainfrom SteveL-MSFT:indesiredstate
inDesiredState property#115Conversation
| #[serde(rename = "actualState")] | ||
| pub actual_state: Value, | ||
| /// Whether the resource was in the desired state. | ||
| #[serde(rename = "inDesiredState")] | ||
| pub in_desired_state: bool, | ||
| /// The properties that were different from the expected state. | ||
| pub diff_properties: Option<Vec<String>>, | ||
| #[serde(rename = "differingProperties")] | ||
| pub diff_properties: Vec<String>, |
There was a problem hiding this comment.
What effect, if any, does this have on resources that implement their own test operation? I think this change set only applies to how DSC returns the information about a test operation, but better to be sure.
There was a problem hiding this comment.
Although not implemented yet, the expectation is that resources that implement test (with state and/or diff) match the schema that dsc itself returns
There was a problem hiding this comment.
And in those cases, if I follow correctly:
- For
State,dscgenerates thedifferingPropertiesarray for the resource - For
StateAndDiff, the resource is responsible for returning the array of differing properties itself
There was a problem hiding this comment.
Yes, that is the expectation
There was a problem hiding this comment.
How does this change interact with the _inDesiredState well-known property? In the current schema/docs, we have resources that implement test using that property as part of the instance's schema, but this implies that resources which implement test return something other than the data blob for the resource instance.
In other words, given this resource's manifest snippet:
"test": {
// defines the command etc
"return": "state"
},
"schema": {
"embedded": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": { "type": "string" }
}
}
}The resource should return:
{"actualState": { "foo": "bar" }, "inDesiredState": false}instead of the prior contract (which would've had _inDesiredState in the instance schema):
{ "foo": "bar", "_inDesiredState": false}There was a problem hiding this comment.
So the change here is that resources don't emit _inDesiredState anymore unless they return state then it will look like the TestResult schema.
PR Summary
Add
.DS_Storeto .gitignore so I don't have to keep explicitly avoid including itRename JSON property names to be camelCase
Add
inDesiredStateto TestResult, renamediff_propertiesto spell outdifferingPropertiesand make it mandatorycc @michaeltlombardi schema impact
PR Context
Fix #108