-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Convert YAML string issue #129
Comments
This is because YAML has weird rules on accepting many strange Strings as |
OK, thanks for your information. It's really weird, so if I use Feature.MINIMIZE_QUOTES config, it can not keep the idempotent operation, right? (e.g. read "OFF" from a file and overwrite to OFF, and at the second time, it will read OFF and overwrite to false). Any suggestions for this case? can I prevent to transform OFF to false by adding configuration? |
Ok, maybe #90 (to be included in 2.9.9) helps: it will force quoting of "truthy" values? |
Hi cowtowncoder, I think I have found the reason. and also, in https://yaml.org, I find information like this:
because the jackson-dataformats-yaml depends on SnakeYAML, so it can not support the new version of yaml standard. does jackson-dataformats-yaml have any idea about upgrade this? : ) |
I think the values which can be implicitly converted, should be protected when the option |
Fix FasterXML#129 - Backport of FasterXML#137 for 2.9
Fix FasterXML#129 - Backport of FasterXML#137 for 2.9
Fix FasterXML#129 - Backport of FasterXML#137 for 2.9
Thank you for contributing this! I'll be off until next week, and there's bit of backlog, but I added this on my todo list hoping to get that in before 2.0.0.pr1. |
@GuillaumeSmaha Thank you again for the fix -- will be in 2.10.0(.pr1) |
would it be possible to PLEASE add this fix to the jackson 2.9.x versions? I'm using the latest version of GWT (Google Web Toolkit) which is relegated to using a somewhat older version of Jetty 9.2. That version of Jetty doesn't play well with the new Java 9 module-info Annotation parsing (you alluded to something similar in your 2.10 release notes). I'm also willing to open a PR onto the 2.9 branch if that would help. Thanks a lot. |
Unfortunately at this point 2.9 branch is basically closed, except for critical security fixes. Further, this particular fix has non-trivial chance of breaking someone's usage somewhere. So unfortunately I don't think I'd want to backport the fix. |
I've run across this bug testing exactly the same problem, and the fix does not seem to help. The problem seems to now be on the parsing side not on the output side. The parsed object ends up parsing on and off as booleans, so they end up in the resulting structure as a boolean (true or false). If the text comes in as "on" the text is (correctly) written out as: on |
@zurvan2 If there are remaining problems, please file a new issue; comments on closed issues are easy to miss (but I noticed this one :) ). And if so, include a simple reproduction (ideally unit test, but code snippet works) -- that eliminates much of ambiguity of textual description as details on exactly what calls are made sometimes make big difference. |
@cowtowncoder After doing more research, I believe the end result is that jackson 2.x is using SnakeYAML, which only supports YAML 1.1. In YAML 1.1, on and off are valid booleans. So Jackson is currently doing the right thing for parsing. I look forward to jackson 3.x with SnakeYAML Engine that supports YAML 1.2, where on and off are not valid booleans, and will be treated as strings when parsing. |
Ok. That does sound plausible. Jackson YAML module does have a fair bit of logic trying to deal with tricky definitions of "alternate" booleans but it is difficult to get that to line up as expected in all places. |
jackson-dataformat-yaml 2.8.11
why in the first case it will convert it will output OFF/ON, but when it reads OFF/ON, it will change to false/true?
The text was updated successfully, but these errors were encountered: