Skip to content

API UX: internal IDs shouldn't leak #14012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
noerw opened this issue Dec 16, 2020 · 5 comments
Open

API UX: internal IDs shouldn't leak #14012

noerw opened this issue Dec 16, 2020 · 5 comments
Labels
modifies/api This PR adds API routes or modifies them topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@noerw
Copy link
Member

noerw commented Dec 16, 2020

Working with the gitea API in tea, I noticed some shortcomings:

  • Labels are referenced by ID when attaching to issues / pulls. Users don't know this ID, and don't need to know; the label name is the user facing ID. Also, there is no way to look up a label ID by label name.
  • Similar problem exists with issue milestones: To assign a milestone, I need to know the internal ID, which is not how users identify milestones.

I propose to resolve these name <-> ID mappings internally and not leak this internal data model detail. Changes would be breaking, but IMO they're worth it.
This increases both usability as well as performance, as no more extra roundtrip to resolve IDs would be needed.

@noerw noerw added type/proposal The new feature has not been accepted yet but needs to be discussed first. modifies/api This PR adds API routes or modifies them kind/usability labels Dec 16, 2020
@lunny
Copy link
Member

lunny commented Dec 16, 2020

milestone should have an index like Issues/PRs

@lafriks
Copy link
Member

lafriks commented Dec 16, 2020

Problem is that currently labels are not required to have unique name so this will not work if they have same name. Also how would you know if that is organization or repository label as they also can have same name.

@CirnoT
Copy link
Contributor

CirnoT commented Dec 16, 2020

milestone should have an index like Issues/PRs

Impossible, because organization labels are shared.

@CirnoT
Copy link
Contributor

CirnoT commented Dec 16, 2020

Problem is that currently labels are not required to have unique name so this will not work if they have same name

That should definitely be enforced.

Also how would you know if that is organization or repository label as they also can have same name.

Sets should be merged internally, in case of duplicates repo label takes precedence over organization label

@a1012112796
Copy link
Member

Labels are referenced by ID when attaching to issues / pulls. Users don't know this ID, and don't need to know; the label name is the user facing ID. Also, there is no way to look up a label ID by label name.

In curent design, user should get it by GET /repos/{owner}/{repo}/labels which will include label id response.

@delvh delvh added topic/ui-interaction Change the process how users use Gitea instead of the visual appearance and removed kind/usability labels Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modifies/api This PR adds API routes or modifies them topic/ui-interaction Change the process how users use Gitea instead of the visual appearance type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

6 participants