Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Feb 2, 2026

PR Summary

Enable support for adapted resource manifests. This allows adapted resources to pre-define a simpler resource manifest pointing to an adapter without requiring the adapter to perform discovery. The schema is what adapters are expected to return for resources via the list operation. The path field is required and must point to an existing file. The adapted manifest also supports an optional condition field that ignores the resource if it evaluates to false.

For manifest lists, there is a new adaptedResources array property.

Much of the changes is that instead of passing the resource type name across the internal APIs, it passes a DscResource instance instead. Because the path and directory fields of DscResource are private, some code was changed to use ::new() to construct and populate the public fields while set_path() and set_directory() are needed to set them. get_path() and get_directory() will return an error if either are not populated (this shouldn't happen unless there's a bug in the engine). Because the DscResource struct is being reused as the adapted resource manifest schema, several fields needed to be changed to Option<>.

To enable future additions, a new CommandResourceInfo struct is used to pass the resource type name and optionally the path. The path is needed with a new arg kind resourcePathArg which will pass the fully resolved path to the adapter so it doesn't need to perform discovery (update to PSAdapter will come separately).

The Test/Adapter resource was enhanced to cover the new test cases.

It appears that resource output validation against its schema wasn't enforced and this PR fixes that so some resources/tests needed to be udpated.

PR Context

Thought I had opened an issue for this, but can't find it

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables support for adapted resource manifests, allowing resources to pre-define a simpler manifest pointing to an adapter without requiring the adapter to perform discovery. The implementation includes schema changes to DscResource, new discovery logic for adapted resources, and a new resourcePathArg argument kind to pass resolved paths to adapters.

Changes:

  • Added support for adapted resource manifests with a new adaptedResources array in manifest lists and standalone .dsc.adaptedresource.* files
  • Refactored DscResource struct to make path and directory private with accessor methods, and changed several fields to Option<> types for flexibility
  • Added CommandResourceInfo struct and resourcePathArg to pass resource paths to adapters without requiring discovery

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tools/test_group_resource/src/main.rs Updated test resource to use new DscResource::new() pattern and set fields individually
tools/dsctest/src/main.rs Added resource_path parameter to adapter command
tools/dsctest/src/args.rs Added resource_path optional argument to adapter subcommand
tools/dsctest/src/adapter.rs Enhanced adapter to handle resource_path and added support for Adapted/Three resource type
tools/dsctest/dsctest.dsc.manifests.json Added adaptedResources array with test resources and resourcePathArg to adapter manifest
tools/dsctest/adaptedTest.dsc.adaptedResource.json New standalone adapted resource manifest for testing
tools/dsctest/.project.data.json Added adapted resource file to copy list
lib/dsc-lib/src/extensions/discover.rs Updated to use CommandResourceInfo for argument processing
lib/dsc-lib/src/dscresources/resource_manifest.rs Added ResourcePath arg kind and removed import_manifest function
lib/dsc-lib/src/dscresources/dscresource.rs Major refactoring of DscResource struct with private path/directory fields, accessor methods, and changed field types to Option<>
lib/dsc-lib/src/dscresources/command_resource.rs Added CommandResourceInfo struct and updated all invoke functions to accept &DscResource instead of &ResourceManifest
lib/dsc-lib/src/dscerror.rs Added new error types for missing path and directory
lib/dsc-lib/src/discovery/command_discovery.rs Added logic to discover adapted resources from manifests and manifest lists with condition evaluation
lib/dsc-lib/locales/en-us.toml Added new localized strings for adapted resources
dsc/tests/dsc_adapter.tests.ps1 Added comprehensive test cases for adapted resource manifests
dsc/src/subcommand.rs Updated to work with new DscResource structure and removed import_manifest usage
build.data.json Added adapted resource file to build configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ThomasNieto
Copy link
Collaborator

The requireAdapter in the adapted resource manifest has the issue where if an org wants to fork or add different capabilities and public that adapter publicly.

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.

2 participants