You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when your YAML contains case-sensitive keys, only the last one is kept - I ran into this as I am using powershell-yaml to cleanup an OpenAPI Spec file (of which I have not control) and the authors of it made the great decision to have multiple paths duplicated only by case.
I will try to push a fix this week. For compatibility, there will probably be a flag to set for case sensitive keys (I really want to avoid having to revert again). Luckily, powershell allows us to set default values for parameters of specific commandlets using something like:
# Not an option yet. Will probably be added soon.$PSDefaultParameterValues=@{"ConvertFrom-Yaml:UseCaseSensitiveKeys"=$true}
This can be set at the beginning of a powershell script and will be applied automatically whenever you run ConvertFrom-Yaml.
I realize this is late, but if you still need this, I have a PR up that might help. I say might, because while it does not bring back the behavior in #159 , it does add the ability to model the yaml using powershell classes, and map case sensitive keys to specific class properties.
The last time I changed the default behavior of the commandlets, it broke a lot of people's scripts, so I am hesitant to change it back, but we can add new functionality that enables more flexibility.
Activity
gabriel-samfira commentedon May 12, 2025
I will try to push a fix this week. For compatibility, there will probably be a flag to set for case sensitive keys (I really want to avoid having to revert again). Luckily, powershell allows us to set default values for parameters of specific commandlets using something like:
This can be set at the beginning of a powershell script and will be applied automatically whenever you run
ConvertFrom-Yaml.Thanks for reminding me of this.
gabriel-samfira commentedon Jan 4, 2026
Hi @ThaDaVos
I realize this is late, but if you still need this, I have a PR up that might help. I say
might, because while it does not bring back the behavior in #159 , it does add the ability to model the yaml using powershell classes, and map case sensitive keys to specific class properties.The PR is here:
Example usage here:
https://github.com/gabriel-samfira/powershell-yaml/blob/0376d2e7e513719de778a86fa30d3aaab4da1edd/examples/yamlkey-attribute.ps1#L27-L31
And the class that models that yaml is here:
https://github.com/gabriel-samfira/powershell-yaml/blob/models/examples/classes/ServerConfig.ps1
The last time I changed the default behavior of the commandlets, it broke a lot of people's scripts, so I am hesitant to change it back, but we can add new functionality that enables more flexibility.
gabriel-samfira commentedon Jan 5, 2026
the above mentioned PR was merged. Closing this for now. Feel free to reopen if needed.