Type validation conflict in Draft Notes API

Location:

  • lib/api/draft_notes.rb lines 69-70 and 75-76
    • optional :old_line, type: String,
  • app/validators/json_schemas/position.json lines 132-151
    • "old_line": { "oneOf": [{"type":"null"},{"type":"integer"}]}

Problem:

  • API parameter definition declares old_line and new_line as type: String
  • JSON schema validation expects these fields as type: integer
  • This creates an impossible situation where no value can satisfy both validators

Impact:

  • API consumers cannot include these optional fields without getting "must be a valid json schema" errors

Reproduction:

// This fails validation:
{
  "line_range": {
    "start": {
      "line_code": "abc123_1_2",
      "old_line": 1,    // Schema wants integer, API wants string
      "new_line": 2     // Schema wants integer, API wants string  
    }
  }
}

Workaround: Omit the conflicting fields entirely.

Fix: Change the API parameter definitions on lines 69-70 and 75-76 from type: String to type: Integer to match the JSON schema.

Edited by 🤖 GitLab Bot 🤖