Skip to content

Commit 8fd7ef4

Browse files
authored
Merge pull request #734 from michaeltlombardi/schema/main/v3.0.0-fix-update
(SCHEMAS) Fix/update for v3.0.0 release
2 parents 47c0d4f + 272753d commit 8fd7ef4

File tree

265 files changed

+4927
-3239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+4927
-3239
lines changed

schemas/build.ps1

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ using namespace System.Collections
44
<#
55
.SYNOPSIS
66
Build the DSC schema files from the source YAML files.
7-
7+
88
.DESCRIPTION
99
This build script composes the JSON Schema files from the source YAML files, creating new
1010
files in the specified output directory. It creates a schema registry to analyze the source
@@ -15,11 +15,11 @@ using namespace System.Collections
1515
param(
1616
[string]
1717
$OutputDirectory = "$PSScriptRoot",
18-
18+
1919
[Parameter(ParameterSetName='ByPath')]
2020
[string[]]
2121
$ConfigFilePath,
22-
22+
2323
[string[]]
2424
[ValidateSet('Json', 'JsonVSCode', 'Yaml', 'YamlVSCode')]
2525
$OutputFormat = @(
@@ -40,7 +40,7 @@ begin {
4040

4141
[Specialized.OrderedDictionary]
4242
$Map
43-
43+
4444
[Generic.List[Specialized.OrderedDictionary]]
4545
$List
4646

@@ -102,7 +102,7 @@ begin {
102102
# Need to ensure single-item returns get correctly handled as arays,
103103
# not munged into scalars.
104104
if (
105-
($MungedKeyValue.Count -eq 1) -or
105+
($MungedKeyValue.Count -eq 1) -or
106106
($MungedKeyValue -is [Specialized.OrderedDictionary])
107107
) {
108108
$MungedSchema.Add($_.Key, [object[]]$MungedKeyValue)
@@ -308,18 +308,18 @@ begin {
308308
[Parameter(ParameterSetName='FromPath', Mandatory)]
309309
[string]
310310
$Path,
311-
311+
312312
[Parameter(ParameterSetName='FromSchema', Mandatory)]
313313
[Specialized.OrderedDictionary]
314314
$Schema,
315-
315+
316316
[Parameter(ParameterSetName='FromPreset', Mandatory)]
317317
[ValidateSet('ConfigDocument', 'ResourceManifest')]
318318
[string]
319319
$Preset,
320320

321321
[LocalJsonSchemaRegistry] $SchemaRegistry,
322-
322+
323323
[switch]$ForVSCode,
324324
[switch]$WithoutComments,
325325
[switch]$WithoutExamples
@@ -379,9 +379,14 @@ begin {
379379
continue
380380
}
381381

382+
if ($ID -match "$Reference`$") {
383+
Write-Verbose "$ID`n`tSkipping adding self ($Reference) to `$defs"
384+
continue
385+
}
386+
382387
$ReferenceSegments = $Reference.Trim('/') -split '/'
383388
$Working = $MergedSchema.'$defs'
384-
389+
385390
for ($i = 0; $i -lt $ReferenceSegments.Count; $i++) {
386391
$Segment = $ReferenceSegments[$i]
387392

@@ -390,7 +395,7 @@ begin {
390395
$Working = $Working.$Segment
391396
continue
392397
}
393-
398+
394399
# Add an empty dictionary for non-final segments
395400
if ($i -ne ($ReferenceSegments.Count - 1)) {
396401
$Working.Add($Segment, [Specialized.OrderedDictionary]::new())
@@ -446,6 +451,11 @@ begin {
446451
continue
447452
}
448453

454+
if ($ID -match "$Reference`$") {
455+
Write-Verbose "$ID`n`tSkipping adding self ($Reference) to `$defs"
456+
continue
457+
}
458+
449459
if ($Reference -notin $Schema.'$defs'.Keys) {
450460
Write-Verbose "$ID`n`tAdding reference to `$defs: '$Reference'"
451461
$MergedSchema.'$defs'.Add($ReferenceSchema.'$id', $ReferenceSchema)
@@ -524,7 +534,7 @@ begin {
524534

525535
[string]
526536
$OutputDirectory = $PWD,
527-
537+
528538
[string[]]
529539
[ValidateSet('Json', 'JsonVSCode', 'Yaml', 'YamlVSCode')]
530540
$OutputFormat = @(
@@ -567,7 +577,7 @@ begin {
567577
Path = $ConfigFilePath
568578
SchemaRegistry = $SchemaRegistry
569579
}
570-
580+
571581
if ($MergeForNormal) {
572582
$Bundled = Merge-JsonSchema @SharedMergeParams
573583
| Set-BundledSchemaID -BundledName $Name
@@ -716,7 +726,7 @@ process {
716726
foreach ($VSCodeKeyword in $VSCodeKeywords) {
717727
$SchemaData = Remove-JsonSchemaKey -Schema $SchemaData -KeyName $VSCodeKeyword
718728
}
719-
729+
720730
$SchemaData
721731
| ConvertTo-Json -Depth 99
722732
| ForEach-Object { $_ -replace '\r\n', "`n" }

schemas/examples/configuration_document/example.dsc.config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# For testing outside of the repository, set the schema in the yaml server directive to:
2-
# https://raw.githubusercontent.com/PowerShell/DSC/main/2024/04/resource/manifest.json
2+
# https://raw.githubusercontent.com/PowerShell/DSC/main/v3/resource/manifest.json
33
#
44
# Hover on the keys to see the documentation. Try changing values and adding new settings.
5-
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
5+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/config/document.json
66
# Try adding the variables, metadata, and parameters properties,
77
# then use IntelliSense to define a few entries.
88

schemas/examples/output/config.get.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
# yaml-language-server: $schema=../../2024/04/bundled/outputs/config/get.vscode.json
1+
# yaml-language-server: $schema=../../v3.0/bundled/outputs/config/get.vscode.json
22
#
33
# Shows output from `dsc config get --path dsc/examples/osinfo_registry.dsc.yaml
44
#
55
metadata:
66
Microsoft.DSC:
7-
version: 3.0.0-preview.7
8-
operation: Get
9-
executionType: Actual
10-
startDatetime: 2024-04-16T15:29:19.776934500-05:00
11-
endDatetime: 2024-04-16T15:29:20.052168700-05:00
12-
duration: PT0.275234200S
13-
securityContext: Restricted
7+
version: 3.0.0
8+
operation: get
9+
executionType: actual
10+
startDatetime: 2025-05-09T11:57:24.223992200-05:00
11+
endDatetime: 2025-05-09T11:57:25.237202300-05:00
12+
duration: PT1.0132101S
13+
securityContext: restricted
1414
results:
1515
- metadata:
1616
Microsoft.DSC:
17-
duration: PT0.053120900S
17+
duration: PT0.0391229S
1818
name: os
1919
type: Microsoft/OSInfo
2020
result:
2121
actualState:
2222
$id: https://developer.microsoft.com/json-schemas/dsc/os_info/20230303/Microsoft.Dsc.OS_Info.schema.json
2323
family: Windows
24-
version: 10.0.22631
24+
version: 10.0.26100
2525
edition: Windows 11 Enterprise
2626
bitness: '64'
27+
architecture: x86_64
2728
- metadata:
2829
Microsoft.DSC:
29-
duration: PT0.137957200S
30+
duration: PT0.1583279S
3031
name: windows product name
3132
type: Microsoft.Windows/Registry
3233
result:
@@ -37,7 +38,7 @@ results:
3738
String: Windows 10 Enterprise
3839
- metadata:
3940
Microsoft.DSC:
40-
duration: PT0.035664200S
41+
duration: PT0.049571S
4142
name: system root
4243
type: Microsoft.Windows/Registry
4344
result:

schemas/examples/output/config.test.yaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
1-
# yaml-language-server: $schema=../../2024/04/bundled/outputs/config/get.vscode.json
1+
# yaml-language-server: $schema=../../v3.0/bundled/outputs/config/test.vscode.json
22
#
33
# Shows output from `dsc config get --path dsc/examples/osinfo_registry.dsc.yaml
44
#
55
metadata:
66
Microsoft.DSC:
7-
version: 3.0.0-preview.7
8-
operation: Test
9-
executionType: Actual
10-
startDatetime: 2024-04-16T15:31:15.556395700-05:00
11-
endDatetime: 2024-04-16T15:31:15.820044900-05:00
12-
duration: PT0.263649200S
13-
securityContext: Restricted
7+
version: 3.0.0
8+
operation: test
9+
executionType: actual
10+
startDatetime: 2025-05-09T11:57:46.868555-05:00
11+
endDatetime: 2025-05-09T11:57:47.837039900-05:00
12+
duration: PT0.9684849S
13+
securityContext: restricted
1414
results:
1515
- metadata:
1616
Microsoft.DSC:
17-
duration: PT0.061508200S
17+
duration: PT0.0402149S
1818
name: os
1919
type: Microsoft/OSInfo
2020
result:
2121
desiredState: {}
2222
actualState:
2323
$id: https://developer.microsoft.com/json-schemas/dsc/os_info/20230303/Microsoft.Dsc.OS_Info.schema.json
2424
family: Windows
25-
version: 10.0.22631
25+
version: 10.0.26100
2626
edition: Windows 11 Enterprise
2727
bitness: '64'
28+
architecture: x86_64
2829
inDesiredState: true
2930
differingProperties: []
3031
- metadata:
3132
Microsoft.DSC:
32-
duration: PT0.142056900S
33+
duration: PT0.1675133S
3334
name: windows product name
3435
type: Microsoft.Windows/Registry
3536
result:
@@ -45,7 +46,7 @@ results:
4546
differingProperties: []
4647
- metadata:
4748
Microsoft.DSC:
48-
duration: PT0.033704600S
49+
duration: PT0.0618466S
4950
name: system root
5051
type: Microsoft.Windows/Registry
5152
result:

schemas/examples/resource_manifest/foo.dsc.resource.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "../2024/04/bundled/resource/manifest.vscode.json",
2+
"$schema": "../../v3.0/bundled/resource/manifest.vscode.json",
33
"type": "Example/Resource",
44
"description": "An example resource using the schema.",
55
"version": "0.1.0",

schemas/examples/resource_manifest/foo.dsc.resource.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# For testing outside of the repository, set the schema in the yaml server directive to:
2-
# https://raw.githubusercontent.com/PowerShell/DSC/main/2024/04/resource/manifest.json
2+
# https://raw.githubusercontent.com/PowerShell/DSC/main/v3/resource/manifest.json
33
#
44
# Hover on the keys to see the documentation. Try changing values and adding new settings.
5-
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/bundled/resource/manifest.vscode.json
5+
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3/bundled/resource/manifest.vscode.json
66
type: Example/Foo
77
version: 0.1.0
88
description: An example resource to manage the foo application.

schemas/src/config/document.parameter.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
$schema: https://json-schema.org/draft/2020-12/schema
33
$id: <HOST>/<PREFIX>/<VERSION>/config/document.parameter.yaml
44
title: Parameter
5-
description: Defines a runtime option for a DSC Configuration Document.
5+
description: Defines a runtime option for a DSC configuration document.
66

77
markdownDescription: | # VS Code only
88
***
99
[_Online Documentation_][01]
1010
***
1111
12-
Defines a runtime option for a DSC Configuration Document.
12+
Defines a runtime option for a DSC configuration document.
1313
1414
[01]: <DOCS_BASE_URL>/reference/schemas/config/parameter?<DOCS_VERSION_PIN>
1515

schemas/src/config/document.resource.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# yaml-language-server: $schema=https://json-schema.org/draft/2020-12/schema
22
$schema: https://json-schema.org/draft/2020-12/schema
33
$id: <HOST>/<PREFIX>/<VERSION>/config/document.resource.yaml
4-
title: DSC Resource instance
5-
description: Defines an instance of a DSC Resource in a configuration.
4+
title: DSC resource instance
5+
description: Defines an instance of a DSC resource in a configuration.
66

77
type: object
88
required:
@@ -16,7 +16,7 @@ properties:
1616
dependsOn:
1717
title: Instance depends on
1818
description: >-
19-
Defines a list of DSC Resource instances that DSC must successfully process before processing
19+
Defines a list of DSC resource instances that DSC must successfully process before processing
2020
this instance. Each value for this property must be the `resourceID()` lookup for another
2121
instance in the configuration. Multiple instances can depend on the same instance, but every
2222
dependency for an instance must be unique in that instance's `dependsOn` property.
@@ -47,7 +47,7 @@ properties:
4747
[_Online Documentation_][01]
4848
***
4949
50-
Defines a list of DSC Resource instances that DSC must successfully process before processing
50+
Defines a list of DSC resource instances that DSC must successfully process before processing
5151
this instance. Each value for this property must be the `resourceID()` lookup for another
5252
instance in the configuration. Multiple instances can depend on the same instance, but every
5353
dependency for an instance must be unique in that instance's `dependsOn` property.
@@ -67,17 +67,17 @@ properties:
6767
properties:
6868
title: Managed instance properties
6969
description: >-
70-
Defines the properties of the DSC Resource this instance manages. This property's value must
71-
be an object. DSC validates the property's value against the DSC Resource's schema.
70+
Defines the properties of the DSC resource this instance manages. This property's value must
71+
be an object. DSC validates the property's value against the DSC resource's schema.
7272
type: object
7373
# VS Code only
7474
markdownDescription: |
7575
***
7676
[_Online Documentation_][01]
7777
***
7878
79-
Defines the properties of the DSC Resource this instance manages. This property's value must
80-
be an object. DSC validates the property's value against the DSC Resource's schema.
79+
Defines the properties of the DSC resource this instance manages. This property's value must
80+
be an object. DSC validates the property's value against the DSC resource's schema.
8181
8282
[01]: <DOCS_BASE_URL>/reference/schemas/config/resource?<DOCS_VERSION_PIN>#properties-1
8383
@@ -87,9 +87,9 @@ markdownDescription: |
8787
[_Online Documentation_][01]
8888
***
8989
90-
Defines an instance of a DSC Resource in a configuration.
90+
Defines an instance of a DSC resource in a configuration.
9191
92-
The `resources` property of a DSC Configuration document always includes at least one DSC Resource
92+
The `resources` property of a DSC configuration document always includes at least one DSC resource
9393
instance. Together, the instances in a configuration define the desired state that DSC can get,
9494
test, and set on a machine.
9595
@@ -98,7 +98,7 @@ markdownDescription: |
9898
defaultSnippets:
9999
- label: ' New resource instance'
100100
markdownDescription: |-
101-
Defines a new instance of a DSC Resource for the configuration.
101+
Defines a new instance of a DSC resource for the configuration.
102102
103103
```yaml
104104
type: owner[.group][.area]/name
@@ -114,7 +114,7 @@ defaultSnippets:
114114

115115
- label: ' New dependent resource instance'
116116
markdownDescription: |-
117-
Defines a new instance of a DSC Resource for the configuration that depends on another
117+
Defines a new instance of a DSC resource for the configuration that depends on another
118118
instance.
119119
120120
```yaml

0 commit comments

Comments
 (0)