Skip to content

Document schema requires 1 item in resources array #717

@JohnMcPMS

Description

@JohnMcPMS

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.

"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

  1. Have a resource (ResourceWithNoState) that can export 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).
  2. 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

Labels

Issue-BugSomething isn't workingSchema-ImpactChange requires updating a canonical schema for configs or manifests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions