Duplicates allowed for parameters and values (or any HashMap)
Open
@michaeltlombardi is already working on this.
Since Aug 6, 2024.
Doc-Impact
Issue-Bug
- Dominant language
- Rust
- Stars
- 523
- Forks
- 75
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 24
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Summary
Due to default serde behavior, duplicates in deserializing a HashMap is not an error and last one wins. There is another crate serde_with that has a macro that prevents dupes, but it doesn't work if the property is an Option<>. Tried a few ways to resolve this, but couldn't find a solutiont hat doesn't include implementing a custom deserializer. Deferring this work.
Steps to reproduce
$configYaml = @'
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
variables:
myVariable: foo
myVariable: bar
resources:
- name: test
type: Test/Echo
properties:
output: "[variables('myVariable')]"
'@
dsc config get -d $configYaml
Expected behavior
Should error that `myVariable` is defined more than once
Actual behavior
`myVariable` takes the last set value
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.5.0-preview.3
PSEdition Core
GitCommitId 7.5.0-preview.3
OS Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
dsc 3.0.0-preview.8
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.