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

Support decoding maps with boolean keys #2440

Merged
merged 1 commit into from
Sep 14, 2023
Merged

Support decoding maps with boolean keys #2440

merged 1 commit into from
Sep 14, 2023

Conversation

sandwwraith
Copy link
Member

We ignore quoted/unquoted state when decoding maps with number keys, so it is logical to do the same for boolean maps.

Fixes #2438

We ignore quoted/unquoted state when decoding maps with number keys, so it is logical to do the same for boolean maps.

Fixes #2438
@sandwwraith sandwwraith merged commit 7d287c8 into dev Sep 14, 2023
@sandwwraith sandwwraith deleted the fix-boolean-maps branch September 14, 2023 17:53
sandwwraith added a commit that referenced this pull request Feb 12, 2024
Because after #2440 quoted boolean values are allowed by default, and
quoted numbers were allowed even before that.
sandwwraith added a commit that referenced this pull request Feb 16, 2024
Because after #2440 quoted boolean values are allowed by default, and
quoted numbers were allowed even before that.
Comment on lines +271 to 277
/*
* The primitives are allowed to be quoted and unquoted
* to simplify map key parsing and integrations with third-party API.
*/
override fun decodeBoolean(): Boolean {
/*
* We prohibit any boolean literal that is not strictly 'true' or 'false' as it is considered way too
* error-prone, but allow quoted literal in relaxed mode for booleans.
*/
return if (configuration.isLenient) {
lexer.consumeBooleanLenient()
} else {
lexer.consumeBoolean()
}
return lexer.consumeBooleanLenient()
}
Copy link

Choose a reason for hiding this comment

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

@sandwwraith and @qwwdfsad, I think this goes against RFC-4627.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants