Skip to content

config validate command needs to check for duplicate resource names in configuration document #842

Open
@fl0p3k

Description

@fl0p3k

Summary of the new feature / enhancement

In order to avoid errors at runtime, the dsc config validate should detect and provide appropriate error response when a resource name is duplicated in a configuration document.

Configuration:

{
"$schema": "https://aka.ms/dsc/schemas/v3/bundled/config/document.json",
"resources": [
{
"type": "Microsoft.Windows/Registry",
"name": "EnsureTest1Value",
"properties": {
"keyPath": "HKEY_LOCAL_MACHINE\SOFTWARE\TEST",
"valueName": "Test1",
"valueData": { "DWord": 1 },
"_exist": true
}
},
{
"type": "Microsoft.Windows/Registry",
"name": "EnsureTest2Value",
"properties": {
"keyPath": "HKEY_LOCAL_MACHINE\SOFTWARE\TEST",
"valueName": "Test2",
"valueData": { "String": "Hello World!" },
"_exist": true
}
},
{
"type": "Microsoft.Windows/Registry",
"name": "EnsureTest1Value",
"properties": {
"keyPath": "HKEY_LOCAL_MACHINE\SOFTWARE\TEST",
"valueName": "Test",
"valueData": { "String": "Hello World!" },
"_exist": false
}
}
]
}

This below should return false with a reason as duplicate resource name

dsc config validate --file C:\dsc\Demo1.json
valid: true
reason: null

Proposed technical implementation details (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions