Skip to content

Conversation

tgauth
Copy link
Collaborator

@tgauth tgauth commented Aug 20, 2025

PR Summary

  • modify add_metadata() to insert _metadata key into properties for resources and extend existing metadata key for adapters

PR Context

  • any input metadata for a resource should be passed to the resource invocation

@tgauth tgauth requested review from SteveL-MSFT and Copilot August 20, 2025 19:35
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 modifies the add_metadata() function to pass input metadata from configuration resources to the actual resource invocations, enabling resources to access metadata during operations.

  • Modified add_metadata() function to accept an optional resource_metadata parameter
  • For adapters, extend existing metadata with input metadata
  • For resources, insert metadata as _metadata key in properties

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
dsc_lib/src/configure/mod.rs Modified add_metadata() function signature and logic to handle resource metadata, updated all call sites to pass resource metadata
dsc/tests/dsc_metadata.tests.ps1 Added comprehensive tests for metadata passing across different operations (get, set, test, export)

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

@tgauth
Copy link
Collaborator Author

tgauth commented Aug 20, 2025

@SteveL-MSFT - looks like the key name is metadata for adapters, but the test resource uses _metadata. Should I standardize to one name?

if let Some(resource_metadata) = resource_metadata {
let other_metadata = resource_metadata.other;
if let Some(mut properties) = properties {
properties.insert("_metadata".to_string(), Value::Object(other_metadata));
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to check if the resource has a _metadata property before we add it otherwise it will invalidate their schema. There should be a test added for this as well. In the case the resource doesn't handle _metadata, then we don't send it.

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