[YANGTOOLS-1437] Normalize Decimal64 scale in DecimalStringCodec Created: 23/May/22  Updated: 25/May/22  Resolved: 25/May/22

Status: Resolved
Project: yangtools
Component/s: data-impl
Affects Version/s: None
Fix Version/s: 9.0.0, 8.0.6

Type: Improvement Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Blocks
blocks YANGTOOLS-1442 Enforce range constraints in DecimalS... Resolved
is blocked by YANGTOOLS-1440 Add support for adjusting Decimal64 s... Resolved

 Description   

DecimalStringCodec contains the following:

    @Override
    protected Decimal64 deserializeImpl(final String product) {
        // FIXME: run value validation
        return Decimal64.valueOf(product);
    }

This conversion disregards fraction-digits, leading to internal representation not matching the underlying schema. After parsing the string we need to consult the DecimalTypeDefinition and use Decimal64.scaleTo() to normalize the value to match fraction-digits.


Generated at Wed Feb 07 20:56:09 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.