Prerequisites
Summary
When an adapter resource's validate operation returns valid: false with a custom reason field, DSC ignores the reason and only displays a generic error message.
Steps to reproduce
Build a simple adapter and add the reason field:
'Validate' {
# Parse input JSON to validate structure
if ($null -eq $inputObj.resources.properties.path) {
@{
valid = $false
reason = "Missing required property 'path'"
} | ConvertTo-Json -Compress
}
else {
@{ valid = $true } | ConvertTo-Json -Compress
}
}
Expected behavior
Validation: Missing required property 'path' if `path` is not provided.
Actual behavior
Validation: Resource reported input JSON is not valid
Error details
Environment data
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
dsc 3.2.0-preview.10
Visuals
No response
Prerequisites
Summary
When an adapter resource's
validateoperation returnsvalid: falsewith a customreasonfield, DSC ignores the reason and only displays a generic error message.Steps to reproduce
Build a simple adapter and add the
reasonfield:Expected behavior
Validation: Missing required property 'path' if `path` is not provided.Actual behavior
Validation: Resource reported input JSON is not validError details
Environment data
Version
dsc 3.2.0-preview.10
Visuals
No response