swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

[Bug]: Loss of Float Precision When Reading Yaml Files

Open califlower opened this issue 1 month ago • 0 comments

Description

This happens under all versions of OpenAPI. In the jackson mapper, https://github.com/swagger-api/swagger-parser/blob/master/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/ObjectMapperFactory.java#L34 the DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS

Affected Version

Latest Versions

Steps to Reproduce

Read any openapi file that has a float somewhere.

  • In an example
  • In a vendor extension

Expected Behavior

Value is preserved in Java

Actual Behavior

Value loses precision

Logs / Stack Traces

Environment

  • Java version:
  • Build tool:
  • OS:

Additional Context

Checklist

  • [ ] I have searched the existing issues and this is not a duplicate.
  • [ ] I have provided sufficient information for maintainers to reproduce the issue.

califlower avatar Nov 03 '25 16:11 califlower