Can line_code for positions in the discussion API have a better approach?
Excellent point out from @krobelus in !51525 (merged):
-
@krobelus started a discussion: (+1 comment) The "line type" is fairly easy to figure out.. but this one is harder, because one has to look at the source.
I originally created this MR only to make clear that these parameters are optional. But since we're talking about the clarity of the descriptions, the most important one would be here. If we want to fix this in the MR:
The "line code" is defined in
lib/gitlab/git.rb:def diff_line_code(file_path, new_line_position, old_line_position) "#{Digest::SHA1.hexdigest(file_path)}_#{old_line_position}_#{new_line_position}" endso I guess we could say
| `position[line_range][end][line_code]` | string | yes, for multiple lines | SHA1 hash of the filename, followed by '_', the line number before the change, '_', and the line number after the change. Example: when commenting on an added line number 5, this should be something like 'adc83b19e793491b1c6ea0fd8b46cd9f32e292fc_5_5'. |In future we should change the API, so this complicated parameter will no longer be necessary, see also #247521 (comment 476572047). But I don't know how long this will take.
Edited by 🤖 GitLab Bot 🤖