-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: case-insensitive keys when Unmarshalling ? #123
Comments
For this, I'm running ToLower on the input data; considering that case sensitivity is part of the yaml spec, I think it's a better solution than changing the library (although it may be less convenient). |
@dhiltonp, would love if you have a little time to review my PR so we can resolve this 3+ year old issue. I've also run into the same problem, where I'd like to ignore case-sensitivity on unmarshal. |
Additional note, it's important to only ignore case-sensitivity for the key; the value should not be lowered As a workaround I made this: https://github.com/moul/flexyaml I would love to depreciate this repo in favor of an official solution :) |
@moul, my PR only considers case insensitivity for the key; the value is kept as-is. Looking at the mounting PRs backed up over a year, I'm wondering whether this project is still being maintained. I'm going to be working from a fork, unfortunately. In your case, you might do the same; feel free to include my PR if that suits your needs. |
What the actual hell. We all understand the limitation of the first character having to be uppercase due to export requirements... but yaml is case-sensitive. Where the hell does "unmarshalled using the field name lowercased as the default key" come from?! You're making me tag every.... single... fkn field that has an uppercase character in it. Clearly my Fix this in a v3 please. Backwards-incompatible as hell, but you'll be restoring expected behaviour. We're not even asking for complete case-insensitivity. Just that beyond that first unfortunate letter due to exported fields, you don't touch the rest of the string. 2 hours of my life wasted just to understand this "gotcha". And now every time I unmarshal, I have to work around this bug. And yes, it's a bug. No excuses, this is a bug. You're actually removing case-sensitivity from a case-sensitive format. |
So we can load files like these:
As well as
Using
The text was updated successfully, but these errors were encountered: