Repository navigation
Preserve custom metadata when exporting config - #679
Merged
Steve Lee (SteveL-MSFT) merged 3 commits intoMar 10, 2025
Merged
Conversation
Steve Lee (SteveL-MSFT)
requested review from
Aditya Patwardhan (adityapatwardhan),
Copilot and
Tess Gauthier (tgauth)
March 7, 2025 01:13
Contributor
There was a problem hiding this comment.
PR Overview
This PR ensures that any custom metadata fields present in the configuration are preserved during export and updates several type definitions to use ordered maps (Map) instead of unordered HashMaps for consistent ordering. Key changes include:
- Merging custom metadata from the original configuration with newly generated metadata in the export.
- Updating metadata, variables, and references types in configuration and context modules to use Map instead of HashMap.
- Adjusting error messages and metadata field constructions in several functions to reflect these changes.
Reviewed Changes
| File | Description |
|---|---|
| dsc_lib/src/configure/mod.rs | Updated merge logic for metadata and added the new other field. |
| dsc_lib/src/configure/config_doc.rs | Changed metadata, variables, and parameter types from HashMap to Map. |
| dsc_lib/src/configure/context.rs | Updated references and variables types to use Map instead of HashMap. |
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
dsc_lib/src/configure/mod.rs:560
- [nitpick] Consider adding an inline comment to explain the metadata merge logic in invoke_export, clarifying how custom metadata (the 'other' map) from the original configuration is preserved.
match conf.metadata {
Tess Gauthier (tgauth)
approved these changes
Mar 10, 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
Previously, the
metadatamember of a configuration that was being deserialized only filled in theMicrosoft.DSCmember and unknown fields were not being preserved. Change is to use the flatten all unknown fields and copy them to the resulting exported configuration.Also changed some places to use
Mapinstead ofHashMapas it preserves order.PR Context
Fix #668