Skip to content

Commit

Permalink
Merge pull request #71 from siemens/license_obligations
Browse files Browse the repository at this point in the history
fix(license_obligations): Add type field to response

Reviewed-by: mishra.gaurav@siemens.com
Tested-by: mishra.gaurav@siemens.com
  • Loading branch information
GMishx authored Jun 18, 2024
2 parents a35203c + 7eaca0a commit 7940f0a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/laas/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,16 @@ const docTemplate = `{
"topic": {
"type": "string",
"example": "copyleft"
},
"type": {
"type": "string",
"enum": [
"obligation",
"restriction",
"risk",
"right"
],
"example": "obligation"
}
}
},
Expand Down
10 changes: 10 additions & 0 deletions cmd/laas/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,16 @@
"topic": {
"type": "string",
"example": "copyleft"
},
"type": {
"type": "string",
"enum": [
"obligation",
"restriction",
"risk",
"right"
],
"example": "obligation"
}
}
},
Expand Down
8 changes: 8 additions & 0 deletions cmd/laas/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions pkg/api/obligationmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func GetObligationMapByTopic(c *gin.Context) {

resObMap = models.ObligationMapUser{
Topic: topic,
Type: obligation.Type,
Shortnames: shortnameList,
}

Expand Down Expand Up @@ -155,6 +156,7 @@ func GetObligationMapByLicense(c *gin.Context) {
return
}
resObMapList = append(resObMapList, models.ObligationMapUser{
Type: obligation.Type,
Topic: obligation.Topic,
Shortnames: []string{licenseShortName},
})
Expand Down Expand Up @@ -538,6 +540,7 @@ func createObligationMapUser(obligation models.Obligation, obMaps []models.Oblig
}
return &models.ObligationMapUser{
Topic: obligation.Topic,
Type: obligation.Type,
Shortnames: shortnameList,
}, nil
}
1 change: 1 addition & 0 deletions pkg/models/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down

0 comments on commit 7940f0a

Please sign in to comment.