Hyperfoil / Horreum

Benchmark results repository service
https://horreum.hyperfoil.io/
Apache License 2.0
34 stars 30 forks source link

Find usages API not completely working #1682

Open lampajr opened 1 month ago

lampajr commented 1 month ago

Describe the bug

Find label usages is not properly working on UI, the API requests seems good but the UI is not properly filled in:

image

The text should be something like Report config <b>{loc.title}</b> in {loc.where} {loc.name ? loc.name : ""}

As you can see loc.where and loc.name (and also loc.configId)are empty.

After some investigation, the API is properly returning those fields properly filled in. IIUC the problem seems in the OpenAPI definition, as it was constructed assuming some sort of inheritance which does not actually exists in OpenAPI specs:

  1. In the horreum-api we have an abstract LabelLocation schema which is extended by several locations, e.g., LabelInReport
  2. The autogenerated client code (for the models) does not reflect that inheritance and you'll have two distinct classes, the LabelLocation and LabelInReport (the latter having all fields coming from LabelLocation and their owns)
  3. The UI calls the client method findUsages which is returning LabelLocation[] the most generic one, thus it will simply discard all other fields

To Reproduce

  1. Simply look for a label (in a specific schema having some usages on reports) and click find usages
  2. You should see the table is not properly filled in
  3. If you click the "Go to", it will redirect to an undefined report config id, this is because also loc.configId is undefined.

Version

What is the version of Horreum ?

Discovered on 0.13 but it was affecting also previous versions.

lampajr commented 1 month ago

I think the proper way to handle this use case is using the Discriminator.