Skip to content

Fix start and end position types to integer in Draft Notes API

What does this MR do and why?

There is a type mismatch in the Draft Notes API. In ./lib/api/discussions.rb:

  optional :start, type: Hash do
    optional :line_code, type: String, desc: 'Start line code for multi-line note'
    optional :type, type: String, desc: 'Start line type for multi-line note'
    optional :old_line, type: String, desc: 'Start old_line line number'  # should not be a string!
    optional :new_line, type: String, desc: 'Start new_line line number'  # should not be a string!
  end

and in the JSON validation schema ./app/validators/json_schemas/position.json:

"old_line": {
  "oneOf": [
    { "type": "null" },
    { "type": "integer" }  // integer!
  ]
},
"new_line": {
  "oneOf": [
    { "type": "null" },
    { "type": "integer" }  // integer!
  ]
}

References

Merge request reports

Loading