[Fix][scala-sttp][circe] Add NaN-tolerant Decoder[Double] for non-finite values#23611
Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom Apr 24, 2026
Merged
Conversation
Contributor
Author
|
@wing328 this is a relatively simple fix targeted only to scala-sttp3 with circe generator. Do you think you can review and include it as part of v7.22.0 milestone? Thank you! |
Member
|
cc @clasnake (2017/07), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) @Fish86 (2023/06) |
Member
|
just merged. thanks for the fix please test with the latest master when you've time. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23610.
Adds a NaN-tolerant
Decoder[Double]to thescala-sttp+circegenerator. The defaultDecoder.decodeDoublerejects the JSON strings"NaN","Infinity","-Infinity"- values many servers emit when Jackson encounters non-finite doubles. Generated clients hitDecodingFailureon any response containing such a value.The new
NanTolerantDoubleDecoderis added toAdditionalTypeSerializersso it applies to every generated model'sDoublefields. Strict numeric parsing stays as the first path; string fallback only handles the three non-finite IEEE 754 values.PR checklist
master"fixes #123"present in the PR description)cc @chameleon82 (Scala sttp)
Summary by cubic
Adds a NaN-tolerant
Decoder[Double]to thescala-sttpgenerator withcirceto accept "NaN", "Infinity", and "-Infinity". Prevents response decoding failures when servers emit these non-finite numbers. Fixes #23610.NanTolerantDoubleDecoderinAdditionalTypeSerializers; tries strict numeric first, then string fallback for the three IEEE 754 values.Doublefields.Written for commit 8641a01. Summary will update on new commits.