-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
Issue-BugSomething isn't workingSomething isn't workingSchema-ImpactChange requires updating a canonical schema for configs or manifestsChange requires updating a canonical schema for configs or manifests
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Summary
The document schema requires 1 item in the resources
array, but dsc.exe
will accept and generate documents with an empty resources
array.
DSC/schemas/v3.0.0/config/document.json
Lines 42 to 46 in d769405
"resources": { | |
"title": "DSC Configuration document resources", | |
"description": "Defines a list of DSC Resource instances for the configuration to manage.", | |
"type": "array", | |
"minItems": 1, |
The minItems
should be either removed or set to 0.
Steps to reproduce
- Have a resource (
ResourceWithNoState
) that canexport
with no state configured so that it produces no output (or just create a resource manifest with export and point it at an executable that will produce no output). - Run
dsc resource export -r ResourceWithNoState
# Output from: dsc resource export -r ResourceWithNoState
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
contentVersion: 1.0.0
resources: []
Piping that back into dsc like dsc resource export -r ResourceWithNoState | dsc config test -f -
also succeeds:
# Output from: dsc resource export -r ResourceWithNoState | dsc config test -f -
metadata:
Microsoft.DSC:
version: 3.0.0
operation: test
executionType: actual
startDatetime: 2025-03-20T14:35:37.857292600-07:00
endDatetime: 2025-03-20T14:35:46.704326700-07:00
duration: PT8.8470341S
securityContext: restricted
results: []
messages: []
hadErrors: false
PS Another bonus issue: dsc searches all adapters for resources despite not needing to find any, leading to this empty test taking anywhere from 6 to 28 seconds.
Expected behavior
The schema definition for resources matches the observed behavior which has no minimum item requirement.
Actual behavior
An empty resources array is allowed, but the schema requires 1 item.
Error details
Environment data
N/A
Version
3.0.0
Visuals
No response
Metadata
Metadata
Assignees
Labels
Issue-BugSomething isn't workingSomething isn't workingSchema-ImpactChange requires updating a canonical schema for configs or manifestsChange requires updating a canonical schema for configs or manifests