Skip to content

Fix: Handle double values in forcedVariationsMap#213

Merged
madhuchavva merged 1 commit into
mainfrom
fix/forced-variations-double-deserialization
Jun 25, 2026
Merged

Fix: Handle double values in forcedVariationsMap#213
madhuchavva merged 1 commit into
mainfrom
fix/forced-variations-double-deserialization

Conversation

@vazarkevych

Copy link
Copy Markdown
Collaborator

Fix: Handle Double Values in Forced Variations

Overview

This PR makes forced variation parsing tolerant of numeric values that come from JSON deserialization as Double instead of Integer.

Previously, forced variation values were assumed to be integers. When values originated from JSON or other external sources, whole-number values could be represented as 1.0, which was not handled consistently.

What Changed

  • Added normalization for forced variation maps.
  • Supports numeric values represented as:
    • Integer
    • Long
    • BigInteger
    • BigDecimal
    • Double
    • Float
    • Gson numeric JsonPrimitive
  • Converts whole-number doubles such as 1.0 to 1.
  • Rejects unsupported values without crashing:
    • strings
    • booleans
    • objects
    • fractional values like 1.5
    • NaN / Infinity
    • values outside the integer range
  • Keeps public forced variation getters as Map<String, Integer> for backward compatibility.

@madhuchavva madhuchavva merged commit 0e5cb83 into main Jun 25, 2026
6 checks passed
@madhuchavva madhuchavva deleted the fix/forced-variations-double-deserialization branch June 25, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants