Skip to content

JsonNumber::isIntegral did not have the same semantic meaning as in json-schema #123

@sebastian-toepfer

Description

@sebastian-toepfer

unsure if it is a bug in json-p spec or here.

in json-schema 0.0 or 1.0 are valid integer values, but not for JsonNumber::isIntegral.

instead of

public boolean isIntegral() {
  bigdecimal().scale() == 0
}

it should be

public boolean isIntegral() {
  bigdecimal().stripTrailingZeros().scale() <= 0
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions