Skip to content
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

Provide unique IDs for items retrieved with list queries #1228

Open
Etsija opened this issue Oct 15, 2024 · 1 comment
Open

Provide unique IDs for items retrieved with list queries #1228

Etsija opened this issue Oct 15, 2024 · 1 comment
Labels
api Issues related to the API. enhancement New feature or request

Comments

@Etsija
Copy link
Contributor

Etsija commented Oct 15, 2024

In front-end, we have a need to create dynamic parametrized routes for the details of items retrieved from back-end, for example rule violations, vulnerabilities and issues. This will give us the opportunity to dedicate more informative and visual sub-pages to inspect the details of these items, instead of just showing the details as part of the main table, as we have done for vulnerabilities and rule violations so far.

For construction of these parametrized routes, we need from back-end an id for each item, which is unique in some related context. This context can vary; for example, ortRunId is not globally unique, but it is unique within a repository, so we are using it when constructing a list of ORT runs for a repository.

As many (if not all) database tables in ORT Server contain a unique Id of type bigint for each item in a table, it would be extremely convenient for us if the back-end would return those ids as part of the items returned in a list query.

Screenshot from 2024-10-14 11-39-45

@mnonnenmacher
Copy link
Contributor

The main problem with providing unique ids is that the query endpoints do not always map directly to a single table. Instead, the SQL queries behind the endpoints could join multiple tables, making it not obvious which id could be used and risking that ids are not unique. Some ideas how this could be addressed:

  • Composite keys: Combine the unique ids of the involved tables in a format like table1ID-table2Id-....
  • Hash keys: Generate a hash from the id columns of the involved tables.

Some requirements to consider:

  • Do the generated ids have to be globally unique?
  • Do the generated ids have to be stable across multiple requests with different settings (sorting, filtering)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants