Bypass duplicated mapping key ?
See original GitHub issueWhen loading a YAML file with a duplicate key, I got this message error.
{
"name":"YAMLException",
"reason":"duplicated mapping key",
"mark":{...},
"message":"duplicated mapping key at line 388, column 5:\n last_published: \"Last published\"\n ^"
}"
Is there a way to bypass this error and take the last value input, here, to have duplicate as true ?
test:
duplicate: false
duplicate: true
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Remove duplicated mapping key in config/locales/en.yml
The source project of this merge request has been removed. Remove duplicated mapping key in config/locales/en.yml.
Read more >Hi, i have been having issues with my template. trying to track ...
Hi, i have been having issues with my template. trying to track this error. i can not find any file to fix. or...
Read more >YAMLException: duplicated mapping key at line 112, column 1
When I run my application I am getting this error in my cmd. Attached my YAML file.
Read more >Ords Parser error duplicated mapping key - swagger
Hi! I have posted about this error before. "Ords 21.3.1.301.2050 - swagger duplicated key" Any solution for this?
Read more >java - Ignore duplicates when producing map using streams
The other way is to "start" with either a Hash or a Set...And carefully track through to make sure the keys never duplicate...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@arcanis ok, create a new issue with this details please. Need to think.
@puzrin By any chance, would you be open to reevaluate this? We’re using
js-yaml
on Yarn (our lockfiles are now regular Yaml), and to make our users’ life easier we try to gracefully recover from lockfile merge conflicts (basically we parse both current and incoming versions of the lockfile, then merge them together). It turns out that in some circumstances Git will generate a bogus lockfile that duplicates some keys.In our case it’s not a big deal (it’s best effort recovery, and both entries contain the same data anyway), but the lack of option to signal to js-yaml that it should just ignore the problem means that we sometimes have to throw pretty annoying errors:
When that happens, there’s no other choice for the user than remove the lockfile, and lose all their current locked resolutions. It’s not a great experience 🙁