Skip to content

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

@califlower

Description

@califlower

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions