[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: |
|
||||||||||||
| 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. |