diff --git a/cmd/laas/docs/docs.go b/cmd/laas/docs/docs.go index 2938c8d..95b10bd 100644 --- a/cmd/laas/docs/docs.go +++ b/cmd/laas/docs/docs.go @@ -2229,6 +2229,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 3ac21fb..811fb47 100644 --- a/cmd/laas/docs/swagger.json +++ b/cmd/laas/docs/swagger.json @@ -2222,6 +2222,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 35bd53f..a364118 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 f556922..5663e0d 100644 --- a/pkg/models/types.go +++ b/pkg/models/types.go @@ -394,6 +394,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"` }