Skip to content

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Sep 20, 2025

PR Summary

  • the config property within adapter section of resource manifest is renamed to inputKind which accepts full (meaning config) or single (meaning just a single resource). However, config is an allowed alias for backwards compat.
  • as noted above, the resource manifest format changed, best example is the test adapter manifest which shows specifying single for inputKind, but also for the args, there's a new object:
            {
                "resourceTypeArg": "--resource-type"
            }

where this arg object will use the value of resourceTypeArg as the parameter nae and supply the target resource type for the adapter as the parameter value.

  • the launch.json change only applies to macOS and leverages an OSS script to pretty print variables in VSCode under debugging instead of showing the memory address
  • the previous embedded code for get, set, test, delete, and export for adapters got moved to help functions which handles full or single adapter invocation
  • since process_args() needs the target resource type to fill in the parameter value, some plumbing was added in the existing functions to ensure this gets passed through
  • helper function added to retreive the adapter inputKind
  • test adapter added to dsctest which doesn't adapt anything but holds the resources internally

PR Context

Fix #931

@SteveL-MSFT SteveL-MSFT added Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests Breaking Change labels Sep 20, 2025
Copy link
Contributor

@Copilot 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 introduces a new adapter functionality that allows adapters to work against single resources instead of requiring full configuration objects. The primary change replaces the config property with inputKind in adapter manifests, supporting both "full" (original behavior) and "single" (new capability) modes, with backwards compatibility maintained through aliasing.

Key changes:

  • Introduces AdapterInputKind enum with Full and Single variants to replace the previous ConfigKind
  • Adds ResourceType argument kind to pass target resource type information to adapters
  • Implements helper functions to handle both adapter invocation modes
  • Creates a test adapter in dsctest tool to demonstrate the new functionality

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/test_group_resource/src/main.rs Adds target_resource field initialization for resource definitions
tools/dsctest/src/main.rs Adds adapter subcommand handling and schema support
tools/dsctest/src/args.rs Defines CLI arguments for adapter operations and resource types
tools/dsctest/src/adapter.rs Implements test adapter with single resource support
tools/dsctest/resourceadapter.dsc.resource.json Manifest for test adapter using new inputKind: "single" format
dsc_lib/src/extensions/discover.rs Updates process_args call to include resource type parameter
dsc_lib/src/dscresources/resource_manifest.rs Replaces ConfigKind with AdapterInputKind and adds ResourceType argument
dsc_lib/src/dscresources/dscresource.rs Adds adapter helper methods and target resource support
dsc_lib/src/dscresources/command_resource.rs Updates all invoke functions to accept target resource parameter
dsc_lib/src/configure/mod.rs Adds discovery access method and adapter input kind checking
dsc_lib/locales/en-us.toml Adds new localization strings for adapter error messages
dsc/tests/dsc_adapter.tests.ps1 Comprehensive test suite for adapter functionality
.vscode/launch.json Adds macOS debugging configuration with pretty printer

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Oct 2, 2025
Merged via the queue into PowerShell:main with commit 9110c74 Oct 2, 2025
4 checks passed
@SteveL-MSFT SteveL-MSFT deleted the adapter-single branch October 2, 2025 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New adapter interface for resource invocation
2 participants