Skip to content

JSON Import of License Fails When Boolean Values Are Provided as Strings #126

@Vaibhavsahu2810

Description

@Vaibhavsahu2810

Description

When importing licenses via the /api/v1/licenses/import endpoint, the system currently fails if boolean fields ("marydone") are provided as strings in the JSON file. This results in a 500 error with the message:

{
  "status": 500,
  "message": "invalid json",
  "error": "json: cannot unmarshal string into Go struct field LicenseDB.marydone of type bool",
  "path": "/api/v1/licenses/import",
  "timestamp": "2025-03-24T12:30:15+05:30"
}

Steps to Reproduce

  1. Use licenseRef.json containing license data with "marydone": "f" (as a string)
  2. Submit this file to the import endpoint
  3. Observe the 500 error response

Expected Behavior

The API should handle string representations of boolean values and convert them appropriately using parseBool function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions