Skip to content
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

Add YAMLParser.Feature.PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS to allow disabling of coercion of Boolean-like Strings #389

Merged

Conversation

axelniklasson
Copy link
Contributor

Introduce a new feature flag to YAMLParser that when explicitly enabled, leads to the following words (irrespective of case) being parsed as strings instead of booleans:

  • yes
  • no
  • off
  • on

Note that y/n are already parsed as strings and this change will not impact how true and false are being parsed - they will still be parsed as booleans.

Fixes #388

@cowtowncoder cowtowncoder added cla-needed PR looks good (although may also require code review), but CLA needed from submitter 2.15 Fix or feature targeted at 2.15 release labels Feb 24, 2023
@cowtowncoder
Copy link
Member

Ok I think this looks fine on first look (I'll need to go over it once more before merging just in case but nothing off so far). So I think I'd like to get it merged.

But one (and only) process thing: if I haven't asked for and gotten CLA:

https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf

yet, it'd be needed before the first contribution (and it's then good for any number of contributions to Jackson project).

The usual way is to print it, fill & sign, scan/photo, email to info at fasterxml dot com.

Once I get that I can proceed with merging.

Thank you for this contribution & looking forward to merging it!

@axelniklasson
Copy link
Contributor Author

Thanks for looking @cowtowncoder! Added the @since tag and sent over the signed CLA as well.

@cowtowncoder cowtowncoder removed the cla-needed PR looks good (although may also require code review), but CLA needed from submitter label Feb 27, 2023
@cowtowncoder
Copy link
Member

CLA received, doing last review now.


public void testParseBooleanLikeWordsAsString_enabledFF() throws Exception
{
YAMLFactory f = new YAMLFactory().enable(YAMLParser.Feature.PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this to use builder-based configuration, merges more cleanly in master (3.0 has immutable factories).

@cowtowncoder cowtowncoder merged commit e73ab58 into FasterXML:2.15 Feb 27, 2023
@cowtowncoder cowtowncoder changed the title feat: add feature flag to parse boolean like words as strings Add YAMLParser.Feature.PARSE_BOOLEAN_LIKE_WORDS_AS_STRINGS to allow disabling of coercion of Boolean-like Strings Feb 27, 2023
@axelniklasson
Copy link
Contributor Author

Thanks for the quick turnaround @cowtowncoder, happy to see this merged! Do you by any chance have a rough timeline for when 2.15 might be available?

@cowtowncoder
Copy link
Member

@axelniklasson Hoping to get release candidate out in early March (in 2 weeks?), and from that, 3-4 weeks for final release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.15 Fix or feature targeted at 2.15 release
Projects
None yet
2 participants