Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

michaeltlombardi
Copy link
Collaborator

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:

  • Version2023_08, Bundled2023_08, and VSCode2023_08 for 2023/08
  • Version2023_10, Bundled2023_10, and VSCode2023_10 for 2023/10

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:

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.
1. `Bundled<YYYY>_<MM>` - The canonical URI to the bundled schema. When
   using this schema, only the bundled schema needs to be retrieved.
1. `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:

- `Version2023_08`, `Bundled2023_08`, and `VSCode2023_08` for 2023/08
- `Version2023_10`, `Bundled2023_10`, and `VSCode2023_10` for 2023/10

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.
@michaeltlombardi
Copy link
Collaborator Author

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

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Oct 24, 2023
Merged via the queue into PowerShell:main with commit 5236f26 Oct 24, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the $schema URIs for manifests to 2023/10
2 participants