diff --git a/cmd/laas/docs/docs.go b/cmd/laas/docs/docs.go index e5639ad..160501b 100644 --- a/cmd/laas/docs/docs.go +++ b/cmd/laas/docs/docs.go @@ -2196,6 +2196,16 @@ const docTemplate = `{ "topic": { "type": "string", "example": "copyleft" + }, + "type": { + "type": "string", + "enum": [ + "obligation", + "restriction", + "risk", + "right" + ], + "example": "obligation" } } }, diff --git a/cmd/laas/docs/swagger.json b/cmd/laas/docs/swagger.json index 19354bd..67d079b 100644 --- a/cmd/laas/docs/swagger.json +++ b/cmd/laas/docs/swagger.json @@ -2189,6 +2189,16 @@ "topic": { "type": "string", "example": "copyleft" + }, + "type": { + "type": "string", + "enum": [ + "obligation", + "restriction", + "risk", + "right" + ], + "example": "obligation" } } }, diff --git a/cmd/laas/docs/swagger.yaml b/cmd/laas/docs/swagger.yaml index 99ffdc8..f97905d 100644 --- a/cmd/laas/docs/swagger.yaml +++ b/cmd/laas/docs/swagger.yaml @@ -515,6 +515,14 @@ definitions: topic: example: copyleft type: string + type: + enum: + - obligation + - restriction + - risk + - right + example: obligation + type: string type: object models.ObligationPATCHRequestJSONSchema: properties: diff --git a/pkg/api/obligationmap.go b/pkg/api/obligationmap.go index a9982a6..7d777a1 100644 --- a/pkg/api/obligationmap.go +++ b/pkg/api/obligationmap.go @@ -84,6 +84,7 @@ func GetObligationMapByTopic(c *gin.Context) { resObMap = models.ObligationMapUser{ Topic: topic, + Type: obligation.Type, Shortnames: shortnameList, } @@ -155,6 +156,7 @@ func GetObligationMapByLicense(c *gin.Context) { return } resObMapList = append(resObMapList, models.ObligationMapUser{ + Type: obligation.Type, Topic: obligation.Topic, Shortnames: []string{licenseShortName}, }) @@ -538,6 +540,7 @@ func createObligationMapUser(obligation models.Obligation, obMaps []models.Oblig } return &models.ObligationMapUser{ Topic: obligation.Topic, + Type: obligation.Type, Shortnames: shortnameList, }, nil } diff --git a/pkg/models/types.go b/pkg/models/types.go index a4f1e9c..37b34dd 100644 --- a/pkg/models/types.go +++ b/pkg/models/types.go @@ -375,6 +375,7 @@ type ObligationMap struct { // ObligationMapUser Structure with obligation topic and license shortname list, a simple representation for user. type ObligationMapUser struct { Topic string `json:"topic" example:"copyleft"` + Type string `json:"type" example:"obligation" enums:"obligation,restriction,risk,right"` Shortnames []string `json:"shortnames" example:"GPL-2.0-only,GPL-2.0-or-later"` }