Skip to content

Commit 2e35862

Browse files
(SCHEMA) Update schemas for the provider->adapter rename
This change updates the source schemas to account for renaming DSC Resource Providers to DSC Resource Adapters in PowerShell#334. This is a breaking schema change that requires a new canonical URI, so the change also adds new schema URIs to DSC to account for the changes. The regenerated schemas will be added in the next commit.
1 parent e57fac8 commit 2e35862

File tree

8 files changed

+165
-40
lines changed

8 files changed

+165
-40
lines changed

dsc_lib/src/configure/config_doc.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ pub struct Resource {
142142
#[derive(Debug, Default, Clone, Copy, Hash, Eq, PartialEq, Deserialize, Serialize, JsonSchema)]
143143
pub enum DocumentSchemaUri {
144144
#[default]
145+
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json")]
146+
Version2024_04,
147+
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/bundled/config/document.json")]
148+
Bundled2024_04,
149+
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/bundled/config/document.vscode.json")]
150+
VSCode2024_04,
145151
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/config/document.json")]
146152
Version2023_10,
147153
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/config/document.json")]
@@ -159,7 +165,7 @@ pub enum DocumentSchemaUri {
159165
impl Default for Configuration {
160166
fn default() -> Self {
161167
Self {
162-
schema: DocumentSchemaUri::Version2023_08,
168+
schema: DocumentSchemaUri::Version2024_04,
163169
parameters: None,
164170
variables: None,
165171
resources: Vec::new(),
@@ -172,7 +178,7 @@ impl Configuration {
172178
#[must_use]
173179
pub fn new() -> Self {
174180
Self {
175-
schema: DocumentSchemaUri::Version2023_08,
181+
schema: DocumentSchemaUri::Version2024_04,
176182
parameters: None,
177183
variables: None,
178184
resources: Vec::new(),

dsc_lib/src/dscresources/resource_manifest.rs

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ pub struct ResourceManifest {
6666
#[derive(Debug, Default, Clone, Copy, Hash, Eq, PartialEq, Deserialize, Serialize, JsonSchema)]
6767
pub enum ManifestSchemaUri {
6868
#[default]
69+
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/resource/manifest.json")]
70+
Version2024_04,
71+
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/bundled/resource/manifest.json")]
72+
Bundled2024_04,
73+
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/bundled/resource/manifest.vscode.json")]
74+
VSCode2024_04,
6975
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/resource/manifest.json")]
7076
Version2023_10,
7177
#[serde(rename = "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/resource/manifest.json")]

schemas/build.ps1

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ using namespace System.Collections
33

44
<#
55
.SYNOPSIS
6+
Build the DSC schema files from the source YAML files.
7+
8+
.DESCRIPTION
9+
This build script composes the JSON Schema files from the source YAML files, creating new
10+
files in the specified output directory. It creates a schema registry to analyze the source
11+
schemas and resolve references for bundling.
612
#>
713

814
[cmdletbinding(DefaultParameterSetName='ByConfig')]

schemas/schemas.config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
host: https://raw.githubusercontent.com
22
prefix: PowerShell/DSC/main/schemas
3-
version: 2023/10
3+
version: 2024/04
44
docs_base_url: https://learn.microsoft.com/powershell/dsc
55
docs_version_pin: view=dsc-3.0&preserve-view=true
66
bundle_schemas:

schemas/src/config/document.yaml

+60-6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ properties:
3434
- <HOST>/<PREFIX>/<VERSION>/config/document.yaml
3535
- <HOST>/<PREFIX>/<VERSION>/bundled/config/document.yaml
3636
- <HOST>/<PREFIX>/<VERSION>/bundled/config/document.vscode.yaml
37+
- <HOST>/<PREFIX>/2023/10/config/document.yaml
38+
- <HOST>/<PREFIX>/2023/10/bundled/config/document.yaml
39+
- <HOST>/<PREFIX>/2023/10/bundled/config/document.vscode.yaml
3740
- <HOST>/<PREFIX>/2023/08/config/document.yaml
3841
- <HOST>/<PREFIX>/2023/08/bundled/config/document.yaml
3942
- <HOST>/<PREFIX>/2023/08/bundled/config/document.vscode.yaml
@@ -113,6 +116,51 @@ properties:
113116
> This schema uses keywords that are only recognized by VS Code. While DSC can still
114117
> validate the document when it uses this schema, other tools may error or behave in
115118
> unexpected ways.
119+
- | # <HOST>/<PREFIX>/2023/10/config/document.yaml
120+
<!-- force a line break -->
121+
122+
> #### `2023/10` non-bundled
123+
>
124+
> Indicates that the configuration document adheres to the `2023/10` schema. This version
125+
> is deprecated, and should only be used for compatibility with `alpha.5` and earlier.
126+
> Migrate to using the `<VERSION>` of the schema
127+
>
128+
> This URL points to the canonical non-bundled schema. When it's used for validation, the
129+
> validating client needs to retrieve this schema and every schema it references.
130+
131+
- | # <HOST>/<PREFIX>/2023/10/bundled/config/document.yaml
132+
<!-- force a line break -->
133+
134+
> #### `2023/10` bundled
135+
>
136+
> Indicates that the configuration document adheres to the `2023/10` schema. This version
137+
> is deprecated, and should only be used for compatibility with `alpha.5` and earlier.
138+
> Migrate to using the `<VERSION>` of the schema
139+
>
140+
> This URL points to the bundled schema. When it's used for validation, the validating
141+
> client only needs to retrieve this schema.
142+
>
143+
> This schema uses the bundling model introduced for JSON Schema 2020-12. While DSC can
144+
> still validate the document when it uses this schema, other tools may error or behave
145+
> in unexpected ways.
146+
- | # <HOST>/<PREFIX>/2023/10/bundled/config/document.vscode.yaml
147+
<!-- force a line break -->
148+
149+
> #### `2023/10` enhanced authoring
150+
>
151+
> Indicates that the configuration document adheres to the `2023/10` schema. This version
152+
> is deprecated, and should only be used for compatibility with `alpha.5` and earlier.
153+
> Migrate to using the `<VERSION>` of the schema
154+
>
155+
> This URL points to the enhanced authoring schema. This schema is much larger than the
156+
> other schemas, as it includes additional definitions that provide contextual help and
157+
> snippets that the others don't include.
158+
>
159+
> This schema uses keywords that are only recognized by VS Code. While DSC can still
160+
> validate the document when it uses this schema, other tools may error or behave in
161+
> unexpected ways.
162+
163+
# Old Schema
116164
- | # <HOST>/<PREFIX>/2023/08/config/document.yaml
117165
<!-- force a line break -->
118166
@@ -130,9 +178,12 @@ properties:
130178
131179
> #### `2023/08` bundled
132180
>
133-
> Indicates that the configuration document adheres to the `2023/08` schema. This URL
134-
> points to the bundled schema. When it's used for validation, the validating client
135-
> only needs to retrieve this schema.
181+
> Indicates that the configuration document adheres to the `2023/08` schema. This version
182+
> is deprecated, and should only be used for compatibility with `alpha.3` and earlier.
183+
> Migrate to using the `<VERSION>` of the schema
184+
>
185+
> This URL points to the bundled schema. When it's used for validation, the validating
186+
> client only needs to retrieve this schema.
136187
>
137188
> This schema uses the bundling model introduced for JSON Schema 2020-12. While DSC can
138189
> still validate the document when it uses this schema, other tools may error or behave
@@ -142,9 +193,12 @@ properties:
142193
143194
> #### `2023/08` enhanced authoring
144195
>
145-
> Indicates that the configuration document adheres to the `2023/08` schema. This URL
146-
> points to the enhanced authoring schema. This schema is much larger than the other
147-
> schemas, as it includes additional definitions that provide contextual help and
196+
> Indicates that the configuration document adheres to the `2023/08` schema. This version
197+
> is deprecated, and should only be used for compatibility with `alpha.3` and earlier.
198+
> Migrate to using the `<VERSION>` of the schema
199+
>
200+
> This URL points to the enhanced authoring schema. This schema is much larger than the
201+
> other schemas, as it includes additional definitions that provide contextual help and
148202
> snippets that the others don't include.
149203
>
150204
> This schema uses keywords that are only recognized by VS Code. While DSC can still

schemas/src/outputs/resource/list.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ properties:
8282
type: string
8383
pattern: ^\w+$
8484
requires:
85-
title: Required DSC Resource Provider
85+
title: Required DSC Resource Adapter
8686
description: >-
87-
Defines the fully qualified type name of the DSC Resource Provider the
87+
Defines the fully qualified type name of the DSC Resource Adapter the
8888
DSC Resource depends on.
8989
oneOf:
9090
- $ref: /<PREFIX>/<VERSION>/definitions/resourceType.yaml

schemas/src/resource/manifest.provider.yaml schemas/src/resource/manifest.adapter.yaml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# yaml-language-server: $schema=https://json-schema.org/draft/2020-12/schema
22
$schema: https://json-schema.org/draft/2020-12/schema
3-
$id: <HOST>/<PREFIX>/<VERSION>/resource/manifest.provider.yaml
3+
$id: <HOST>/<PREFIX>/<VERSION>/resource/manifest.adapter.yaml
44

5-
title: Provider
5+
title: Adapter
66
description: >-
7-
Defines the DSC Resource as a DSC Resource Provider. A DSC Resource Provider enables users to
7+
Defines the DSC Resource as a DSC Resource Adapter. A DSC Resource Adapter enables users to
88
manage resources that don't have their own manifests with DSC.
99
markdownDescription: | # VS Code only
1010
***
1111
[_Online Documentation_][01]
1212
***
1313
14-
Defines the DSC Resource as a DSC Resource Provider. A DSC Resource Provider enables users to
14+
Defines the DSC Resource as a DSC Resource Adapter. A DSC Resource Adapter enables users to
1515
manage resources that don't have their own manifests with DSC.
1616
17-
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/provider?<DOCS_VERSION_PIN>
17+
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/adapter?<DOCS_VERSION_PIN>
1818
1919
type: object
2020
required:
@@ -24,15 +24,15 @@ properties:
2424
list:
2525
title: List Command
2626
description: >-
27-
Defines how DSC must call the DSC Resource Provider to list its supported DSC Resources.
27+
Defines how DSC must call the DSC Resource Adapter to list its supported DSC Resources.
2828
markdownDescription: | # VS Code only
2929
***
3030
[_Online Documentation_][01]
3131
***
3232
33-
Defines how DSC must call the DSC Resource Provider to list its supported DSC Resources.
33+
Defines how DSC must call the DSC Resource Adapter to list its supported DSC Resources.
3434
35-
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/provider?<DOCS_VERSION_PIN>#list
35+
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/adapter?<DOCS_VERSION_PIN>#list
3636
type: object
3737
required:
3838
- executable
@@ -49,7 +49,7 @@ properties:
4949
is only required when the command isn't recognizable by the operating system as an
5050
executable.
5151
52-
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/provider?<DOCS_VERSION_PIN>#executable
52+
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/adapter?<DOCS_VERSION_PIN>#executable
5353
args:
5454
$ref: /<PREFIX>/<VERSION>/definitions/commandArgs.yaml
5555
markdownDescription: |
@@ -75,11 +75,11 @@ properties:
7575
registry resources list
7676
```
7777
78-
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/provider?<DOCS_VERSION_PIN>#args
78+
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/adapter?<DOCS_VERSION_PIN>#args
7979
config:
8080
title: Expected Configuration
8181
description: >-
82-
Defines whether the provider expects to receive a full and unprocessed configuration as a
82+
Defines whether the adapter expects to receive a full and unprocessed configuration as a
8383
single JSON blob over stdin or a sequence of JSON Lines for each child resource's
8484
configurations.
8585
type: string
@@ -92,21 +92,21 @@ properties:
9292
[_Online Documentation_][01]
9393
***
9494
95-
Defines whether the provider expects to receive a full and unprocessed configuration as a
95+
Defines whether the adapter expects to receive a full and unprocessed configuration as a
9696
single JSON blob over stdin or a sequence of JSON Lines for each child resource's
9797
configurations.
9898
99-
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/provider?<DOCS_VERSION_PIN>#config
99+
[01]: <DOCS_BASE_URL>/reference/schemas/resource/manifest/adapter?<DOCS_VERSION_PIN>#config
100100
markdownEnumDescriptions:
101101
- | # full
102102
_Full and unprocessed config as a JSON blob_
103103
104-
> Indicates that the provider expects a JSON blob containing the full and unprocessed
104+
> Indicates that the adapter expects a JSON blob containing the full and unprocessed
105105
> configuration as a single JSON blob over `stdin`.
106106
- | # sequence
107107
_Resource instances as JSON Lines_
108108
109-
> Indicates that the provider expects each resource's configuration as a [JSON Line][01]
109+
> Indicates that the adapter expects each resource's configuration as a [JSON Line][01]
110110
> over `stdin`.
111111
112112
[01]: https://jsonlines.org/
@@ -125,7 +125,7 @@ examples:
125125
defaultSnippets: # VS Code only
126126
- label: ' Define without arguments'
127127
markdownDescription: |
128-
Define the provider config kind and `list` command for the resource when no arguments are
128+
Define the adapter config kind and `list` command for the resource when no arguments are
129129
required.
130130
body:
131131
config: $1
@@ -134,7 +134,7 @@ defaultSnippets: # VS Code only
134134

135135
- label: ' Define with arguments'
136136
markdownDescription: |
137-
Define the provider config kind and `list` command for the resource when at least one
137+
Define the adapter config kind and `list` command for the resource when at least one
138138
argument is required.
139139
body:
140140
config: $1

0 commit comments

Comments
 (0)