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

Lenient numeric decoding #1606

Open
wants to merge 4 commits into
base: series/0.18
Choose a base branch
from
Open

Conversation

Baccata
Copy link
Contributor

@Baccata Baccata commented Oct 4, 2024

This adds opt-in logic to allow decoding numeric values from JSON strings.
This also exposes a new method on the SimpleRestJsonBuilder to configure the underlying JSON codecs, without having to duplicate the smart-builder methods every time we add new options.

PR Checklist (not all items are relevant to all PRs)

  • Added unit-tests (for runtime code)
  • Added documentation
  • Updated changelog

Comment on lines +81 to +85
/**
* Enables lenient decoding of numeric values, where numbers may be carried by JSON strings
* as well as JSON numbers.
*/
def withLenientNumericDecoding: JsoniterCodecCompiler
Copy link
Member

Choose a reason for hiding this comment

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

question: shall we just call it lenient decoding, in case we add more cases of leniency? such as, case-insensitivity (which might not be doable if there are members with names like foo and FOO, but might be possible in many cases)

Copy link
Member

Choose a reason for hiding this comment

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

and we'd just mention number handling because it happens to be the only thing for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd rather have more granular options than a "one size fits all" option.

@Baccata Baccata marked this pull request as ready for review October 7, 2024 10:02
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.

2 participants