Is there a way to disable some features from SnakeYaml
See original GitHub issue(by @exbe https://github.com/FasterXML/jackson-dataformat-yaml/issues/85)
SnakeYaml converts some string values into Boolean while resolving input (link)
public static final Pattern BOOL = Pattern.compile("^(?:yes|Yes|YES|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF)$");
While it is useful feature, some yamls might be converted with wrong value. Think about country code “NO”, which is Norway.
Is there a way to disable or have better control over this with YamlParser features?
PS Workaround is simple, just surround value with quotes, e.g.
countries:
- AU
- "NO"
- MOON
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Solved - YAML anchors and aliases - how to disable them?
Hello, as in title, im wondering if there is an easy way of disabling anchors and aliases that happens to show up in...
Read more >Preventing YAML parsing vulnerabilities with snakeyaml in Java
The outdated version of snakeyaml contains a Denial of Service vulnerability. We highly recommend that you update snakeyaml to version 1.26 or ...
Read more >How to hide bean type in snakeyaml - Stack Overflow
Use org.yaml.snakeyaml.representer.Representer , set Tag.MAP to hide the root tag. Representer representer = new Representer(); representer.
Read more >How to ignore unknown local tags - snakeyaml - Bitbucket
I have some YAMl files that I need to manipulate. Unfortunately, the YAML contains local tags that can not be resolved to classes....
Read more >YAML anchors and aliases and how to disable them |
PyYAML does not have built-in setting allowing disabling of the default behaviour. Fortunately there are two ways in which we can prevent ......
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
@jeff-miller-cfa I think it should be only true|false (this is also the default in snakeyaml-engine now)
a workaround to this is to create a custom
Resolver
then override theaddImplicitResolver
method like below: