diff --git a/cmd/laas/docs/docs.go b/cmd/laas/docs/docs.go index c94903b..c010b18 100644 --- a/cmd/laas/docs/docs.go +++ b/cmd/laas/docs/docs.go @@ -2141,6 +2141,18 @@ const docTemplate = `{ "active": { "type": "boolean" }, + "category": { + "type": "string", + "enum": [ + "Distribution", + "Patent", + "Internal", + "Contractual", + "Export Control", + "General" + ], + "example": "Distribution" + }, "classification": { "type": "string", "enum": [ @@ -2325,50 +2337,13 @@ const docTemplate = `{ } }, "models.ObligationPATCHRequestJSONSchema": { - "type": "object", - "properties": { - "active": { - "type": "boolean", - "example": true - }, - "classification": { - "type": "string", - "enum": [ - "green", - "white", - "yellow", - "red" - ] - }, - "comment": { - "type": "string", - "example": "This is a comment." - }, - "modifications": { - "type": "boolean" - }, - "text": { - "type": "string", - "example": "Source code be made available when distributing the software." - }, - "text_updatable": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "obligation", - "restriction", - "risk", - "right" - ] - } - } + "type": "object" }, "models.ObligationPOSTRequestJSONSchema": { "type": "object", "required": [ "active", + "category", "classification", "comment", "modifications", @@ -2382,6 +2357,18 @@ const docTemplate = `{ "type": "boolean", "example": true }, + "category": { + "type": "string", + "enum": [ + "Distribution", + "Patent", + "Internal", + "Contractual", + "Export Control", + "General" + ], + "example": "Distribution" + }, "classification": { "type": "string", "enum": [ @@ -2477,6 +2464,18 @@ const docTemplate = `{ } } }, + "models.OptionalData-string": { + "type": "object", + "properties": { + "isDefined": { + "description": "This is set to true if corresponding key is present in json object", + "type": "boolean" + }, + "value": { + "type": "string" + } + } + }, "models.PaginationMeta": { "type": "object", "properties": { diff --git a/cmd/laas/docs/swagger.json b/cmd/laas/docs/swagger.json index e02fecb..c26ea53 100644 --- a/cmd/laas/docs/swagger.json +++ b/cmd/laas/docs/swagger.json @@ -2134,6 +2134,18 @@ "active": { "type": "boolean" }, + "category": { + "type": "string", + "enum": [ + "Distribution", + "Patent", + "Internal", + "Contractual", + "Export Control", + "General" + ], + "example": "Distribution" + }, "classification": { "type": "string", "enum": [ @@ -2318,50 +2330,13 @@ } }, "models.ObligationPATCHRequestJSONSchema": { - "type": "object", - "properties": { - "active": { - "type": "boolean", - "example": true - }, - "classification": { - "type": "string", - "enum": [ - "green", - "white", - "yellow", - "red" - ] - }, - "comment": { - "type": "string", - "example": "This is a comment." - }, - "modifications": { - "type": "boolean" - }, - "text": { - "type": "string", - "example": "Source code be made available when distributing the software." - }, - "text_updatable": { - "type": "boolean" - }, - "type": { - "type": "string", - "enum": [ - "obligation", - "restriction", - "risk", - "right" - ] - } - } + "type": "object" }, "models.ObligationPOSTRequestJSONSchema": { "type": "object", "required": [ "active", + "category", "classification", "comment", "modifications", @@ -2375,6 +2350,18 @@ "type": "boolean", "example": true }, + "category": { + "type": "string", + "enum": [ + "Distribution", + "Patent", + "Internal", + "Contractual", + "Export Control", + "General" + ], + "example": "Distribution" + }, "classification": { "type": "string", "enum": [ @@ -2470,6 +2457,18 @@ } } }, + "models.OptionalData-string": { + "type": "object", + "properties": { + "isDefined": { + "description": "This is set to true if corresponding key is present in json object", + "type": "boolean" + }, + "value": { + "type": "string" + } + } + }, "models.PaginationMeta": { "type": "object", "properties": { diff --git a/cmd/laas/docs/swagger.yaml b/cmd/laas/docs/swagger.yaml index 967cf06..e3ebb1f 100644 --- a/cmd/laas/docs/swagger.yaml +++ b/cmd/laas/docs/swagger.yaml @@ -324,6 +324,16 @@ definitions: properties: active: type: boolean + category: + enum: + - Distribution + - Patent + - Internal + - Contractual + - Export Control + - General + example: Distribution + type: string classification: enum: - green @@ -460,40 +470,22 @@ definitions: type: string type: object models.ObligationPATCHRequestJSONSchema: - properties: - active: - example: true - type: boolean - classification: - enum: - - green - - white - - yellow - - red - type: string - comment: - example: This is a comment. - type: string - modifications: - type: boolean - text: - example: Source code be made available when distributing the software. - type: string - text_updatable: - type: boolean - type: - enum: - - obligation - - restriction - - risk - - right - type: string type: object models.ObligationPOSTRequestJSONSchema: properties: active: example: true type: boolean + category: + enum: + - Distribution + - Patent + - Internal + - Contractual + - Export Control + - General + example: Distribution + type: string classification: enum: - green @@ -527,6 +519,7 @@ definitions: type: string required: - active + - category - classification - comment - modifications @@ -570,6 +563,14 @@ definitions: example: 200 type: integer type: object + models.OptionalData-string: + properties: + isDefined: + description: This is set to true if corresponding key is present in json object + type: boolean + value: + type: string + type: object models.PaginationMeta: properties: limit: diff --git a/pkg/models/types.go b/pkg/models/types.go index 717662c..6f12ce5 100644 --- a/pkg/models/types.go +++ b/pkg/models/types.go @@ -283,6 +283,7 @@ type Obligation struct { Active bool `json:"active"` TextUpdatable bool `json:"text_updatable" example:"true"` Md5 string `gorm:"unique" json:"-"` + Category string `json:"category" enums:"Distribution,Patent,Internal,Contractual,Export Control,General" example:"Distribution"` } // ObligationPreview is just the Type and Topic of Obligation @@ -307,6 +308,7 @@ type ObligationPOSTRequestJSONSchema struct { Comment string `json:"comment" binding:"required"` Shortnames []string `json:"shortnames" binding:"required" example:"GPL-2.0-only,GPL-2.0-or-later"` Active bool `json:"active" binding:"required" example:"true"` + Category string `json:"category" enums:"Distribution,Patent,Internal,Contractual,Export Control,General" binding:"required" example:"Distribution"` } // ObligationPATCHRequestJSONSchema represents the data format of PATCH request for obligation @@ -318,6 +320,7 @@ type ObligationPATCHRequestJSONSchema struct { Comment OptionalData[string] `json:"comment" swaggertype:"string" example:"This is a comment."` Active OptionalData[bool] `json:"active" swaggertype:"boolean" example:"true"` TextUpdatable OptionalData[bool] `json:"text_updatable" swaggertype:"boolean"` + Category OptionalData[string] `json:"category" enums:"Distribution,Patent,Internal,Contractual,Export Control,General" binding:"required" example:"Distribution"` } // ObligationResponse represents the response format for obligation data.