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

(SCHEMAS) Update schemas for preview.7 #397

Conversation

michaeltlombardi
Copy link
Collaborator

@michaeltlombardi michaeltlombardi commented Apr 10, 2024

PR Summary

These changes update the source schemas to account for the changes in preview.7. Because the updates include breaking changes from the prior schema, 2023/10, this requires creating a new canonical URI as 2024/04 and generating the updated schemas.

PRs with potential schema changes are captured in the following list. Checked items indicate the schema changes have been addressed in this PR. Unchecked items indicate that the changes need to be investigated and possibly incorporated.

PR Context

Changes in the next release require schema updates, including breaking changes.

@michaeltlombardi michaeltlombardi force-pushed the schemas/main/update-schemas-preview.7 branch 4 times, most recently from 660f61d to 8064adb Compare April 16, 2024 15:45
@michaeltlombardi michaeltlombardi marked this pull request as ready for review April 16, 2024 21:02
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.
This commit generates the canonical schemas from source using the new
canonical URI for `2024/04`, as the changes include a break from the
prior `2023/08` schemas.

It also updates the VS Code settings to use the newest schemas for
IntelliSense and validation.
This change updates the existing tests, example configuration documents, and
resource manifests to use the latest canonical schema URIs that are compatible
with `preview.7`.
This change adds the `kind` property to the resource manifest
schema, as implemented in PowerShell#338. It updates the source schema
and regenerates the composed schemas.
This change updates the example configuration document and resource manifests
to use the `2024/04` URI instead of older versions.
This change updates the output schema for the `dsc resource list` command
to rename the `requires` property to the more semantically correct and
unambiguous `requireAdapter` property, as implemented in PowerShell#373.

It updates both the source and composed schemas.
This change updates the casing for the secure parameter types from
`securestring` and `secureobject` to `secureString` and `secureObject`,
as implemented in PowerShell#364.

It updates both the source and composed schemas.
This change adds the `capabilities` property to the output schema for
the `dsc resource list` command, as implemented in PowerShell#357.

It updates both the source and composed schemas.
This change adds the `delete` method-defining property to the resource manifest
schema and updates the `capabilities` enumeration to include `SetHandlesExist`
and `Delete`, as implemented in PowerShell#379.

It updates both the source and composed schemas.
This change updates the `metadata` property of the configuration
document schema to include the validated `Microsoft.DSC` property,
with the `requiredSecurityContext` child property, as implemented
in PowerShell#351.

This change updates both the source and composed schemas.
This change updates guidance for resources that implement the `delete`
method to always define the `_exist` property in the JSON schema for
the resource's properties, now that DSC can automatically determine
whether to delete an instance as implemented in PowerShell#382.

This change updates both the source and composed schemas.
This change updates the definition of the command arguments from
an array of strings to an array that can include strings and a
single object representing a JSON input argument, as implemented
in PowerShell#385.

The shared definition includes default snippets to simplify adding
arguments to an `args` list, but not validation for the maximum
number of JSON input arguments.

It updates the definition for the schema command and adapter list
command to expect arrays of strings instead of the shared definition
for the command arguments, as those commands never get JSON data
for input and their struct definition in Rust expects an optional
vector of strings, not command arguments.

It updates the definition for the `delete`, `export`, `get`, `set`,
`test`, and `validate` commands to:

1. Make `input` optional, if it was required before, because that
   matches the struct definitions and DSC no longer requires the
   `input` kind when `args` includes a JSON input argument.
1. Add validation using three branches of the `oneOf` keyword,
   to handle mixed support for the `contains`, `minContains`, and
   `maxContains` keywords across the JSON and YAML support in VS
   Code. It raises specific error messages now when:

   - `input` isn't defined and `args` doesn't include a JSON input
     argument, or includes more than one JSON input argument.
   - `input` is defined and `args` includes more than one JSON
     input argument.
1. Update the default snippets to enable users to quickly define
   the command without any arguments, with only string arguments,
   and with a JSON input argument.
1. Update the in-editor help and clarify that the command must
   define `input`, a JSON input argument in `args`, or both.

This change updates both the source and composed schemas.
This changes defines the metadata properties that DSC returns in the
results for the `dsc config *` commands, as implemented in PowerShell#405.

It defines each metadata property as a separate file in a new folder
for metadata schemas for easier reuse, as well as two definitions
of the `metadata` property used across different result objects, one
for the top-level of a configuration and one for resource instances
in that result.

This change also required a minor fix to the build script to account
for array items that are objects solely defined by a `$ref` keyword
and to find and compose schemas from the new `metadata` folder.

The change includes the rename for the `requiredSecurityContext`
metadata property to `securityContext`.
Prior to this change, the output schemas were bundled, but not
with in the format compatible with VS Code.

This change adds the VS Code compatible bundle format to the
composed schemas configuration. This enables us to show new
examples of output data with IntelliSense to make inspecting
the output structure easier and more interactive.

This change also reorganizes the schema examples folder to
use subfolders for configuration documents, resource manifests,
and the new output data objects.
Prior to this change, the example configuration document for
assertions was invalid, using the `_ensure` property instead
of `_exist`. This change updates the document to be valid.
@michaeltlombardi michaeltlombardi force-pushed the schemas/main/update-schemas-preview.7 branch from cbf1e78 to 87ca2a9 Compare April 18, 2024 13:31
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Apr 18, 2024
Merged via the queue into PowerShell:main with commit 0a934c5 Apr 18, 2024
4 checks passed
@michaeltlombardi michaeltlombardi deleted the schemas/main/update-schemas-preview.7 branch April 18, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants