Skip to content

Commit f315af4

Browse files
(GH-642) Ensure camelCase for items in dsc_lib
Prior to this change, the structs and enums in `dsc_lib` didn't consistently use camelCase - most property names and enum values use camelCase, but not all - and this inconsistency isn't predictable for end users, who need to consult the JSON Schemas to be sure. This change updates the definitions to rename the fields and values when serializing and deserializing, which also updates their JSON Schema. A future change is required to update the canonical schemas in the repository to match these updates.
1 parent 41bd1c8 commit f315af4

30 files changed

+57
-49
lines changed

configurations/windows/windows_baseline.dsc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
33
metadata:
44
Microsoft.DSC:
5-
securityContext: Elevated
5+
securityContext: elevated
66
resources:
77
- name: Validate the OS is Windows
88
type: Microsoft.DSC/Assertion

dsc/assertion.dsc.resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "Microsoft.DSC/Assertion",
44
"version": "0.1.0",
55
"description": "`test` will be invoked for all resources in the supplied configuration.",
6-
"kind": "Group",
6+
"kind": "group",
77
"get": {
88
"executable": "dsc",
99
"args": [

dsc/examples/groups.dsc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
33
metadata:
44
Microsoft.DSC:
5-
requiredSecurityContext: Current # this is the default and just used as an example indicating this config works for admins and non-admins
5+
requiredSecurityContext: current # this is the default and just used as an example indicating this config works for admins and non-admins
66
resources:
77
- name: Last Group
88
type: Microsoft.DSC/Group

dsc/examples/require_admin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
55
metadata:
66
Microsoft.DSC:
7-
securityContext: Elevated
7+
securityContext: elevated
88
resources:
99
- name: os
1010
type: Microsoft/OSInfo

dsc/examples/require_nonadmin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
44
metadata:
55
Microsoft.DSC:
6-
securityContext: Restricted
6+
securityContext: restricted
77
resources:
88
- name: os
99
type: Microsoft/OSInfo

dsc/examples/winps_script.dsc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
22
metadata:
33
Microsoft.DSC:
4-
securityContext: Elevated
4+
securityContext: elevated
55
resources:
66
- type: Microsoft.Windows/WindowsPowerShell
77
name: Run WinPS script

dsc/group.dsc.resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "Microsoft.DSC/Group",
44
"version": "0.1.0",
55
"description": "All resources in the supplied configuration is treated as a group.",
6-
"kind": "Group",
6+
"kind": "group",
77
"get": {
88
"executable": "dsc",
99
"args": [

dsc/include.dsc.resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "Microsoft.DSC/Include",
44
"version": "0.1.0",
55
"description": "Allows including a configuration file with optional parameter file.",
6-
"kind": "Importer",
6+
"kind": "importer",
77
"get": {
88
"executable": "dsc",
99
"args": [

dsc/tests/dsc_args.tests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ actualState:
9797
$resource = $obj | y2j | ConvertFrom-Json
9898
$resource | Should -Not -BeNullOrEmpty
9999
$resource.Type | Should -BeLike '*/*'
100-
$resource.Kind | Should -BeIn ('Resource', 'Group', 'Importer', 'Adapter')
100+
$resource.Kind | Should -BeIn ('resource', 'group', 'importer', 'adapter')
101101
}
102102
}
103103

@@ -242,7 +242,7 @@ resources:
242242
$a = dsc resource list '*' -a Test* -o json | ConvertFrom-Json
243243
foreach ($r in $a) {
244244
$r.requireAdapter.StartsWith("Test") | Should -Be $true
245-
$r.kind | Should -Be "Resource"
245+
$r.kind | Should -Be "resource"
246246
}
247247
}
248248

@@ -253,7 +253,7 @@ resources:
253253
$r = $a[0]
254254
$r.requireAdapter | Should -Not -BeNullOrEmpty
255255
$r.requireAdapter.StartsWith("Test") | Should -Be $true
256-
$r.kind | Should -Be "Resource"
256+
$r.kind | Should -Be "resource"
257257
}
258258

259259
It 'passing filepath to document arg should error' {

dsc/tests/dsc_config_get.tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Describe 'dsc config get tests' {
4747
$result.results[0].type | Should -BeExactly 'Microsoft.DSC.Debug/Echo'
4848
$result.results[0].result.actualState.output | Should -Be 'hello'
4949
$result.metadata.'Microsoft.DSC'.version | Should -BeLike '3.*'
50-
$result.metadata.'Microsoft.DSC'.operation | Should -BeExactly 'Get'
51-
$result.metadata.'Microsoft.DSC'.executionType | Should -BeExactly 'Actual'
50+
$result.metadata.'Microsoft.DSC'.operation | Should -BeExactly 'get'
51+
$result.metadata.'Microsoft.DSC'.executionType | Should -BeExactly 'actual'
5252
$result.metadata.'Microsoft.DSC'.startDatetime | Should -Not -BeNullOrEmpty
5353
$result.metadata.'Microsoft.DSC'.endDatetime | Should -Not -BeNullOrEmpty
5454
$result.metadata.'Microsoft.DSC'.duration | Should -Not -BeNullOrEmpty

0 commit comments

Comments
 (0)