Gitlab Draft-note API bug when posting multi-line comments
<!--* Use this issue template for suggesting new docs or updates to existing docs. Note: Doc work as part of feature development is covered in the Feature Request template. * For issues related to features of the docs.gitlab.com site, see https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/-/issues * For information about documentation content and process, see https://docs.gitlab.com/development/documentation/--> - [ ] Start this issue's title with `Docs:` or `Docs feedback:`. ## Problem to solve <!--Include the following detail as necessary: * What product or feature(s) affected? * What docs or doc section affected? Include links or paths. * Is there a problem with a specific document, or a feature/process that's not addressed sufficiently in docs? * Any other ideas or requests?--> When using the GitLab Draft Notes API:  https://docs.gitlab.com/api/draft_notes/#create-a-draft-note, we are trying to post multi-line comments using the `position`  arguments. We followed this https://docs.gitlab.com/api/discussions/#parameters-for-multiline-comments to fill the parameters, however GitLab is throwing `An error occurred: 400 (An error occurred: 400 ({"message":{"position":["must be a valid json schema"]}}))` when we send `old_line`, `new_line` parameters in `position[line_range][start]`  argument.   We are providing the correct `line_code`. If we remove the `old_line` and `new_line` parameters (which are optional), the multi-line comment works, but it doesn't show the comment line badge in the UI.\ However, I was also facing issue with `line_code` field. As an example, I posted this multi-line comment through UI and inspected the network call. This is their `line_range` param: ``` { start: { line_code: "****************************************_33_34", type: "old", old_line: 33, new_line: null }, end: { line_code: "****************************************_36_36", type: "new", old_line: null, new_line: 36 } } ``` The comments were applied from `-33` to `+36`. Based on this, not sure how `<old_line>` and `<new_line>` are computed in the `line_code: <SHA>_<old_line>_<new_line>` as `33_34` for start, and `36_36` for end. To summarize the issues that we are observing 1. If I send `old_line` and `new_line` params in `line_range` (we took this information from the network calls, so our request was exactly the same as the network call) GitLab throws `({"message":{"position":["must be a valid json schema"]}}))` 2. The `line_code` format recommended in the doc does not matches what I'm seeing in the network calls while making multi-line comment from the UI. But if I use the same line_code from code, it does works. So not clear on the proper recommendation of `line_code` format. ## Proposal <!--Further specifics for how can we solve the problem.--> Could you please test this API and provide further documentation and examples on use or if there is a bug on Gitlab's side could get an estimate of the fix.
issue