fossology / LicenseDb

GNU General Public License v2.0
12 stars 9 forks source link

Shortnames coming null from "obligation_maps/topic/{topic}" GET api #87

Closed bhowmik94 closed 2 weeks ago

Vaibhavsahu2810 commented 2 weeks ago

Hey @bhowmik94 , To resolve issue #87 where Shortnames were coming as null from the "obligation_maps/topic/{topic}" GET API, I added a nil check for lic.Shortname before appending it to shortnameList in func GetObligationMapByTopic:

for _, lic := range obligation.Licenses {
        if lic.Shortname != nil {
            shortnameList = append(shortnameList, *lic.Shortname)
        }
    }

If you are good with the solution i'll open up a pull request. Please take a look. If this is not the correct solution, could you provide further clarification on the expected behavior for Shortname in this context?

Thanks!

bhowmik94 commented 2 weeks ago

@Vaibhavsahu2810 thanks for providing a solution. But this issue is solved with the latest merge in the main branch. And for the null values, licenses have to be added(explicitly) when creating/updating an obligation, otherwise they will show as

null

.