The position[x] and position[y] attributes of an image diff note may actually be a float instead of an integer
Problem to solve
https://docs.gitlab.com/ee/api/discussions.html#create-new-merge-request-thread shows that the position[x]
and position[y]
attributes of an image diff note should be an integer.
However, in our GitLab instance (v13.7.5-ee), we have found that these attributes can sometimes be floats instead of integers.
This breaks libraries such as gitlab4j because the model class sets the data type to Integer: https://github.com/gitlab4j/gitlab4j-api/blob/master/src/main/java/org/gitlab4j/api/models/Position.java#L45
This breaks our automated systems that use gitlab4j whenever they come across a merge request with an image diff note.
This is the specific error message we saw:
GitLabApiException: Cannot deserialize value of type `java.lang.Integer` from String "199.07407407407408": not a valid Integer value
Proposal
Either:
- truncate the floats to always be integers for the position of image diff notes. (Ideal) OR
- update documentation to say that these attributes are floats instead of integers. (Less ideal)
Who can address the issue
Someone who knows how the position of image diff notes is calculated.
Edited by Tyler Yates