fossology/LicenseDb

Issue with `getallaudits` API response null value

Open

#130 aperta il 26 mar 2025

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Go (29 fork)auto 404
buggood first issue

Metriche repository

Star
 (14 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Issue with getallaudits API response

Description

The getallaudits API is returning an unexpected response structure where the license data contains null values for some fields and includes extra user details within the entity object.

Response Example:

{
  "status": 200,
  "data": [
    {
      "id": 1,
      "user_id": 1,
      "user": {
        "id": 1,
        "username": "chayan",
        "display_name": "<chayan>",
        "user_email": "dasc4885@gmail.com",
        "user_level": "SUPER_ADMIN"
      },
      "timestamp": "2025-03-22T15:39:21.660456+05:30",
      "type": "license",
      "type_id": 1,
      "entity": {
        "shortname": "MIT",
        "fullname": "MIT L",
        "text": "MIT License Text here",
        "url": "https://opensource.org",
        "add_date": "2023-12-01T18:10:25+05:30",
        "copyleft": false,
        "FSFfree": false,
        "OSIapproved": false,
        "GPLv2compatible": false,
        "GPLv3compatible": false,
        "notes": "",
        "Fedora": "",
        "text_updatable": false,
        "detector_type": 1,
        "active": true,
        "source": "",
        "spdx_id": "MIT",
        "risk": 0,
        "flag": 1,
        "marydone": false,
        "external_ref": {},
        "obligations": null,
        "user": {
          "id": 0,
          "username": null,
          "display_name": null,
          "user_email": null,
          "user_level": null
        }
      }
    }
  ],
  "paginationmeta": {
    "resource_count": 1
  }
}

Expected Behavior

The license data should not contain null values for the user fields within the entity object

and obligation null will be fixed after the merge will be fixed after merge of #118

suggestion :

we can also remove the userdetails from the audit struct in json response , because all licenses are already has user details or we can only send the sortname as a response instead of full license details

Guida contributor