Document schema requires 1 item in resources array
Open
@michaeltlombardi is already working on this.
Since Mar 24, 2025.
Issue-Bug
Schema-Impact
- Dominant language
- Rust
- Stars
- 523
- Forks
- 75
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 24
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.
The minItems should be either removed or set to 0.
Steps to reproduce
- Have a resource (
ResourceWithNoState) that canexportwith 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.