PowerShell / DSC

This repo is for the DSC v3 project
MIT License
195 stars 24 forks source link

(GH-224) Convert schema constants to enums #238

Closed michaeltlombardi closed 10 months ago

michaeltlombardi commented 10 months ago

PR Summary

This change converts the string constants for the canonical schema URIs for both the configuration document and resource manifest schemas to enums, defining the valid URIs as variants.

For each supported version of a schema, there are three variants:

  1. Version<YYYY>_<MM> - The canonical URI to the non-bundled schema. Using this schema requires retrieving every referenced schema, but it is also the least-munged.
  2. Bundled<YYYY>_<MM> - The canonical URI to the bundled schema. When using this schema, only the bundled schema needs to be retrieved.
  3. VSCode<YYYY>_<MM> - The canonical URI to the enhanced authoring schema. This schema is specifically implemented to support contextual help and DevX when authoring in VS Code. It is much larger than the other schemas.

Which gives six variants:

Currently, the specified schema is not actually used by DSC to validate the document or manifest. In the future, we could use the version to identify how to validate and process the data.

PR Context

With the breaking changes made in recent PRs, and keeping in mind that we will eventually need to handle different versions of the schema, this PR:

michaeltlombardi commented 10 months ago

Working through this PR, I think it would be worth considering a shortened links, like:

# Unbundled configuration document schema
-https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/config/document.json
+https://aka.ms/dsc/schemas/2023/10/config/document.json

# Bundled configuration document schema
-https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/config/document.json
+https://aka.ms/dsc/schemas/2023/10/config/document.bundled.json

# Enhanced authoring configuration document schema
-https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/config/document.vscode.json
+https://aka.ms/dsc/schemas/2023/10/config/document.vscode.json

# Unbundled configuration document schema
-https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/resource/manifest.json
+https://aka.ms/dsc/schemas/2023/10/resource/manifest.json

# Bundled configuration document schema
-https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/resource/manifest.json
+https://aka.ms/dsc/schemas/2023/10/resource/manifest.bundled.json

# Enhanced authoring configuration document schema
-https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/10/bundled/resource/manifest.vscode.json
+https://aka.ms/dsc/schemas/2023/10/resource/manifest.vscode.json