プロジェクト

全般

プロフィール

Vote #81606

未完了

Add a Revision (Changeset) API end-point with support for inclusion of associated issues

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
0
issue_org_id:
35769
author_id:
519160
assigned_to_id:
0
comments:
2
status_id:
1
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

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

USE: https://www.redminexxx.org/projects/{project_name}/repository/{repository_name}/revisions/{revison_name}.json


journals

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:

* <pre>GET /projects/[id]/repository/[repository_id]/revisions/[revision_id].[format]</pre>
** Example response in JSON for a Git commit:
<pre><code class="json">
{
"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
}
]
}
}
</code></pre>

Some questions about this feature:
* Do we really want to include associated issues like this? It may be better to add an additional @include@ parameter with an @issues@ value to fetch the associated issue data on-demand only.
* Do we really want to name the issues array @issues@ instead of something like @related_issues@ or @associated_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.

Some possible, future additions/improvements:
* Add an actual listing of files added/modified/copied/renamed/deleted to the output via an @include=changes@ parameter value.
An {{collapse(example of what this could look like.)
<pre><code class="json">
{
"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
}
],
"changes": [
["added":
{
"file": "/app/views/repositories/revision.api.rsb"
}
],
["modified":
{
"file": "/trunk/app/controllers/repositories_controller.rb",
"file": "/trunk/app/controllers/application_controller.rb"
}
],
]
}
}
</code></pre>
}}

--------------------------------------------------------------------------------
Thank you for your help, I will look into that when I am back from holiday.
--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリREST API_32 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0