Enable resources to return metadata#947
Merged
SteveL-MSFT merged 7 commits intoPowerShell:mainfrom Jul 9, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Enable resources to return a _metadata object that’s merged into the resource’s metadata field, ignoring any Microsoft.DSC entries (with a warning), and applied consistently across all operations.
- Add
Metadatastruct and CLI support indsctestfor emitting metadata - Enhance
configuratorto extract_metadataintoResource*Result.metadataand emit warnings for reserved keys - Introduce manifest, locale strings, and end-to-end tests for the new Test/Metadata resource
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/dsctest/src/metadata.rs | Define Metadata struct for CLI |
| tools/dsctest/src/main.rs | Register metadata subcommand and serialize metadata outputs |
| tools/dsctest/src/args.rs | Add Metadata variant to CLI args |
| tools/dsctest/metadata.dsc.resource.json | Add manifest for Test/Metadata resource |
| dsc_lib/src/configure/mod.rs | Extract _metadata and integrate into resource metadata |
| dsc_lib/locales/en-us.toml | Add messages for ignored Microsoft.DSC and invalid metadata |
| dsc/tests/dsc_metadata.tests.ps1 | Add tests verifying metadata extraction and warning emission |
Comments suppressed due to low confidence (2)
dsc/tests/dsc_metadata.tests.ps1:27
- [nitpick] Consider adding an assertion for
metadata.countto ensure thecountproperty is populated correctly as part of the metadata object.
$out.results[0].metadata.myNumber | Should -Be 42
tools/dsctest/src/main.rs:134
- [nitpick] The loop variable
iis ambiguous; consider renaming it (e.g.,index) for better readability.
for i in 0..count {
3cff2a3 to
bcb6ead
Compare
tgauth
approved these changes
Jul 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Enable resources to return
_metadataobject that gets populated into the resourcemetadatafield. ReservedMicrosoft.DSCproperty is ignored, but a warning message is emitted. Works for all operations.Also some reordering of existing code to keep it in proper order.
PR Context
Fix #467