Skip to content

Commit

Permalink
Backport parsing enhancement from 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tjquinno committed Oct 15, 2024
1 parent 40614a9 commit af9db8a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openapi/src/main/java/io/helidon/openapi/OpenAPISupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,12 @@ public Object parseValue(String value) {
try {
JsonReader reader = JSON_READER_FACTORY.createReader(new StringReader(value));
JsonValue jsonValue = reader.readValue();
// readValue will truncate the input to convert to a number if it can. Make sure the value is the same
// length as the original.
if (jsonValue.getValueType().equals(JsonValue.ValueType.NUMBER)
&& value.length() != jsonValue.toString().length()) {
return value;
}
return convertJsonValue(jsonValue);
} catch (Exception ex) {
LOGGER.log(Level.SEVERE, String.format("Error parsing value: %s", value), ex);
Expand Down

0 comments on commit af9db8a

Please sign in to comment.