Actions
Patch #35769
openAdd a Revision (Changeset) API end-point with support for inclusion of associated issues
Status:
New
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Description
This is a small patch to add an API call to get details about a revision and the linked issues.
It should be reviewed by someone with some more experience.
EDIT: app/controllers/repositories_controller.rb
ADD: app/views/repositories/revision.rsb
Files
Updated by Mischa The Evil over 3 years ago
- Subject changed from Feature: patch to add simple repositories API call to view revision details + related issues to Add a Revision (Changeset) API end-point with support for inclusion of associated issues
This could be a nice feature. Do you have some specific use-cases in mind with this addition? How do you see this being used without a dedicated end-point to fetch all repository revisions (changesets)?
Some notes on the patch(es):- Please provide a single, unified diff file (git format-patch and git diff output is ok).
- Do not include commented-out code in your diffs unless there's a specific reason to do so.
- No tests are included; to get your code integrated you'd need to write some test coverage to:
- show that your code works as expected;
- show (some) example API-calls with their expectations, given that you're adding to/modifying the API.
What this patch provides:
GET /projects/[id]/repository/[repository_id]/revisions/[revision_id].[format]
- Example response in JSON for a Git commit:
{ "changeset": { "revision": { "id": 24, "repository_id": 2, "revision": "git_commit_hash", "committer": "Committer name <committer_email>", "committed_on": "2021-01-01T00:00:00.000Z", "comments": "Commit message", "commit_date": "2021-01-01", "scmid": "git_commit_hash", "user_id": null }, "issues": [ { "id": 6, "subject": "Issue subject", "root_id": 6, "parent_id": 5 } ] } }
- Example response in JSON for a Git commit:
- Do we really want to include associated issues like this? It may be better to add an additional
include
parameter with anissues
value to fetch the associated issue data on-demand only. - Do we really want to name the issues array
issues
instead of something likerelated_issues
orassociated_issues
? - Do we really want to expose all these revision attributes?
- Do we really want to expose the issue
parent_id
through this end-point? - Do we really want to expose the issue
root_id
through this end-point? AFAIK this attribute isn't exposed to any user at all in the UI.
- Add an actual listing of files added/modified/copied/renamed/deleted to the output via an
include=changes
parameter value.
An example of what this could look like.
Updated by Jan Catrysse over 3 years ago
Thank you for your help, I will look into that when I am back from holiday.
Actions