Skip to content

Commit

Permalink
Merge pull request #159 from gabriel-samfira/revert-case-sensitivity
Browse files Browse the repository at this point in the history
Revert "Fix losing case sensitive keys"
  • Loading branch information
gabriel-samfira authored Dec 14, 2024
2 parents 7e2611b + 8c581a8 commit 5d3ecb4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 0 additions & 9 deletions Tests/powershell-yaml.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,4 @@ int64: 9223372036854775807
} | Should -Not -Throw
}
}

Describe 'Case insensitive keys in mappings' {
It 'should deserialize both keys' {
$yaml = '{"a": 1, "A": 2}'
$result = ConvertFrom-Yaml -Yaml $yaml
$result.a | Should -Be 1
$result.A | Should -Be 2
}
}
}
2 changes: 1 addition & 1 deletion powershell-yaml.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function Convert-YamlMappingToHashtable {
[switch] $Ordered
)
PROCESS {
if ($Ordered) { $ret = [System.Collections.Specialized.OrderedDictionary]::new() } else { $ret = [hashtable]::new() }
if ($Ordered) { $ret = [ordered]@{} } else { $ret = @{} }
foreach($i in $Node.Children.Keys) {
$ret[$i.Value] = Convert-YamlDocumentToPSObject $Node.Children[$i] -Ordered:$Ordered
}
Expand Down

0 comments on commit 5d3ecb4

Please sign in to comment.