From 93dc745e3f68688d8e59f6f75cf43a51748ba027 Mon Sep 17 00:00:00 2001 From: deo002 Date: Fri, 10 May 2024 14:29:55 +0530 Subject: [PATCH] fix(docs): Fix errors in compilation of docs of struct LicensePATCHRequestJSONSchema --- cmd/laas/docs/docs.go | 78 +++++++++++++++++++++++++++++++------- cmd/laas/docs/swagger.json | 78 +++++++++++++++++++++++++++++++------- cmd/laas/docs/swagger.yaml | 53 ++++++++++++++++++++++---- pkg/models/types.go | 36 +++++++++--------- 4 files changed, 193 insertions(+), 52 deletions(-) diff --git a/cmd/laas/docs/docs.go b/cmd/laas/docs/docs.go index dd45f0e..d6e35f0 100644 --- a/cmd/laas/docs/docs.go +++ b/cmd/laas/docs/docs.go @@ -1566,7 +1566,71 @@ const docTemplate = `{ } }, "models.LicensePATCHRequestJSONSchema": { - "type": "object" + "type": "object", + "properties": { + "marydone": { + "type": "boolean" + }, + "rf_FSFfree": { + "type": "boolean" + }, + "rf_Fedora": { + "type": "string" + }, + "rf_GPLv2compatible": { + "type": "boolean" + }, + "rf_GPLv3compatible": { + "type": "boolean" + }, + "rf_OSIapproved": { + "type": "boolean" + }, + "rf_active": { + "type": "boolean" + }, + "rf_copyleft": { + "type": "boolean" + }, + "rf_detector_type": { + "type": "integer", + "example": 1 + }, + "rf_flag": { + "type": "integer", + "example": 1 + }, + "rf_fullname": { + "type": "string", + "example": "MIT License" + }, + "rf_notes": { + "type": "string", + "example": "This license has been superseded." + }, + "rf_risk": { + "type": "integer", + "example": 3 + }, + "rf_source": { + "type": "string" + }, + "rf_spdx_id": { + "type": "string", + "example": "MIT" + }, + "rf_text": { + "type": "string", + "example": "MIT License Text here" + }, + "rf_text_updatable": { + "type": "boolean" + }, + "rf_url": { + "type": "string", + "example": "https://opensource.org/licenses/MIT" + } + } }, "models.LicensePOSTRequestJSONSchema": { "type": "object", @@ -1929,18 +1993,6 @@ 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 18e7a95..88db1d4 100644 --- a/cmd/laas/docs/swagger.json +++ b/cmd/laas/docs/swagger.json @@ -1559,7 +1559,71 @@ } }, "models.LicensePATCHRequestJSONSchema": { - "type": "object" + "type": "object", + "properties": { + "marydone": { + "type": "boolean" + }, + "rf_FSFfree": { + "type": "boolean" + }, + "rf_Fedora": { + "type": "string" + }, + "rf_GPLv2compatible": { + "type": "boolean" + }, + "rf_GPLv3compatible": { + "type": "boolean" + }, + "rf_OSIapproved": { + "type": "boolean" + }, + "rf_active": { + "type": "boolean" + }, + "rf_copyleft": { + "type": "boolean" + }, + "rf_detector_type": { + "type": "integer", + "example": 1 + }, + "rf_flag": { + "type": "integer", + "example": 1 + }, + "rf_fullname": { + "type": "string", + "example": "MIT License" + }, + "rf_notes": { + "type": "string", + "example": "This license has been superseded." + }, + "rf_risk": { + "type": "integer", + "example": 3 + }, + "rf_source": { + "type": "string" + }, + "rf_spdx_id": { + "type": "string", + "example": "MIT" + }, + "rf_text": { + "type": "string", + "example": "MIT License Text here" + }, + "rf_text_updatable": { + "type": "boolean" + }, + "rf_url": { + "type": "string", + "example": "https://opensource.org/licenses/MIT" + } + } }, "models.LicensePOSTRequestJSONSchema": { "type": "object", @@ -1922,18 +1986,6 @@ } } }, - "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 d9a7f3a..69c5736 100644 --- a/cmd/laas/docs/swagger.yaml +++ b/cmd/laas/docs/swagger.yaml @@ -164,6 +164,51 @@ definitions: type: array type: object models.LicensePATCHRequestJSONSchema: + properties: + marydone: + type: boolean + rf_FSFfree: + type: boolean + rf_Fedora: + type: string + rf_GPLv2compatible: + type: boolean + rf_GPLv3compatible: + type: boolean + rf_OSIapproved: + type: boolean + rf_active: + type: boolean + rf_copyleft: + type: boolean + rf_detector_type: + example: 1 + type: integer + rf_flag: + example: 1 + type: integer + rf_fullname: + example: MIT License + type: string + rf_notes: + example: This license has been superseded. + type: string + rf_risk: + example: 3 + type: integer + rf_source: + type: string + rf_spdx_id: + example: MIT + type: string + rf_text: + example: MIT License Text here + type: string + rf_text_updatable: + type: boolean + rf_url: + example: https://opensource.org/licenses/MIT + type: string type: object models.LicensePOSTRequestJSONSchema: properties: @@ -427,14 +472,6 @@ 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 c10eeac..d90d1f6 100644 --- a/pkg/models/types.go +++ b/pkg/models/types.go @@ -91,24 +91,24 @@ type LicenseJson struct { // LicensePATCHRequestJSONSchema struct represents the input format for updating an existing license. // Note that the license ID and shortname cannot be updated. type LicensePATCHRequestJSONSchema struct { - Fullname OptionalData[string] `json:"rf_fullname" example:"MIT License"` - Text OptionalData[string] `json:"rf_text" example:"MIT License Text here"` - Url OptionalData[string] `json:"rf_url" example:"https://opensource.org/licenses/MIT"` - Copyleft OptionalData[bool] `json:"rf_copyleft"` - FSFfree OptionalData[bool] `json:"rf_FSFfree"` - OSIapproved OptionalData[bool] `json:"rf_OSIapproved"` - GPLv2compatible OptionalData[bool] `json:"rf_GPLv2compatible"` - GPLv3compatible OptionalData[bool] `json:"rf_GPLv3compatible"` - Notes OptionalData[string] `json:"rf_notes" example:"This license has been superseded."` - Fedora OptionalData[string] `json:"rf_Fedora"` - TextUpdatable OptionalData[bool] `json:"rf_text_updatable"` - DetectorType OptionalData[int64] `json:"rf_detector_type" example:"1"` - Active OptionalData[bool] `json:"rf_active"` - Source OptionalData[string] `json:"rf_source"` - SpdxId OptionalData[string] `json:"rf_spdx_id" example:"MIT"` - Risk OptionalData[int64] `json:"rf_risk"` - Flag OptionalData[int64] `json:"rf_flag" example:"1"` - Marydone OptionalData[bool] `json:"marydone"` + Fullname OptionalData[string] `json:"rf_fullname" swaggertype:"string" example:"MIT License"` + Text OptionalData[string] `json:"rf_text" swaggertype:"string" example:"MIT License Text here"` + Url OptionalData[string] `json:"rf_url" swaggertype:"string" example:"https://opensource.org/licenses/MIT"` + Copyleft OptionalData[bool] `json:"rf_copyleft" swaggertype:"boolean"` + FSFfree OptionalData[bool] `json:"rf_FSFfree" swaggertype:"boolean"` + OSIapproved OptionalData[bool] `json:"rf_OSIapproved" swaggertype:"boolean"` + GPLv2compatible OptionalData[bool] `json:"rf_GPLv2compatible" swaggertype:"boolean"` + GPLv3compatible OptionalData[bool] `json:"rf_GPLv3compatible" swaggertype:"boolean"` + Notes OptionalData[string] `json:"rf_notes" example:"This license has been superseded." swaggertype:"string"` + Fedora OptionalData[string] `json:"rf_Fedora" swaggertype:"string"` + TextUpdatable OptionalData[bool] `json:"rf_text_updatable" swaggertype:"boolean"` + DetectorType OptionalData[int64] `json:"rf_detector_type" example:"1" swaggertype:"integer"` + Active OptionalData[bool] `json:"rf_active" swaggertype:"boolean"` + Source OptionalData[string] `json:"rf_source" swaggertype:"string"` + SpdxId OptionalData[string] `json:"rf_spdx_id" example:"MIT" swaggertype:"string"` + Risk OptionalData[int64] `json:"rf_risk" swaggertype:"integer" example:"3"` + Flag OptionalData[int64] `json:"rf_flag" example:"1" swaggertype:"integer"` + Marydone OptionalData[bool] `json:"marydone" swaggertype:"boolean"` } // UpdateExternalRefsJSONPayload struct represents the external ref key value