Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1437

Normalize Decimal64 scale in DecimalStringCodec

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Medium Medium
    • 9.0.0, 8.0.6
    • None
    • data-impl
    • None

      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.

            rovarga Robert Varga
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: