Skip to content

Add API endpoints to load a single diff file

We need an endpoint to load a specific diff file when rendering Rapid Diffs.

The endpoints should be created exactly as the diff_files_metadata and diffs_stats were.

And accept these parameters:

  • path: string — path to the file we'd like to load
  • view: string — either parallel or nothing
  • full: boolean (false by default) — load diff with a complete file context, i.e. without any gaps in between diff hunks
  • ignore_whitespace_changes: boolean — hides whitespace changes. Whitespace only diffs should ignore this option and instead return diffs with whitespace (i.e. do not return them in a collapsed state).

Component should be inferred by resource-bound endpoint (an MR endpoint should render a MergeRequestDiffFileComponent, others just DiffFileComponent).

The return format should be rendered diff file HTML.

Edited by Stanislav Lashmanov