From 265ea4a7c64f6d4c4566c2b2fd90230f6f9a0eaa Mon Sep 17 00:00:00 2001 From: Nima Nakhostin Date: Sun, 9 Nov 2025 10:21:41 +0330 Subject: [PATCH] Enhance Swagger Documentation for CMS API - Updated Swagger documentation to include new fields: CompanyName, Country, and Language, improving clarity and usability for API consumers. - Added a new Type field with enumerations for Company and Organization, enhancing data categorization in the CMS API. - Reflected changes in the definitions for CMS entities, ensuring accurate representation of the API structure and expected inputs/outputs. - Improved examples in the documentation to provide better guidance for developers integrating with the CMS API. --- cmd/web/docs/docs.go | 31 +++++++++++++++++++++++++++++++ cmd/web/docs/swagger.json | 31 +++++++++++++++++++++++++++++++ cmd/web/docs/swagger.yaml | 20 ++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/cmd/web/docs/docs.go b/cmd/web/docs/docs.go index b6d9b42..7e79a68 100644 --- a/cmd/web/docs/docs.go +++ b/cmd/web/docs/docs.go @@ -7771,6 +7771,14 @@ const docTemplate = `{ "language": { "type": "string", "example": "en" + }, + "type": { + "allOf": [ + { + "$ref": "#/definitions/cms.CMSType" + } + ], + "example": "company" } } }, @@ -7797,9 +7805,15 @@ const docTemplate = `{ "chart": { "$ref": "#/definitions/cms.chartSection" }, + "company_name": { + "type": "string" + }, "contact": { "$ref": "#/definitions/cms.contactSection" }, + "country": { + "type": "string" + }, "created_at": { "type": "integer" }, @@ -7818,11 +7832,28 @@ const docTemplate = `{ "key": { "type": "string" }, + "language": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/cms.CMSType" + }, "updated_at": { "type": "integer" } } }, + "cms.CMSType": { + "type": "string", + "enum": [ + "company", + "organization" + ], + "x-enum-varnames": [ + "CMSTypeCompany", + "CMSTypeOrganization" + ] + }, "cms.card": { "type": "object", "properties": { diff --git a/cmd/web/docs/swagger.json b/cmd/web/docs/swagger.json index d4f518a..de62922 100644 --- a/cmd/web/docs/swagger.json +++ b/cmd/web/docs/swagger.json @@ -7763,6 +7763,14 @@ "language": { "type": "string", "example": "en" + }, + "type": { + "allOf": [ + { + "$ref": "#/definitions/cms.CMSType" + } + ], + "example": "company" } } }, @@ -7789,9 +7797,15 @@ "chart": { "$ref": "#/definitions/cms.chartSection" }, + "company_name": { + "type": "string" + }, "contact": { "$ref": "#/definitions/cms.contactSection" }, + "country": { + "type": "string" + }, "created_at": { "type": "integer" }, @@ -7810,11 +7824,28 @@ "key": { "type": "string" }, + "language": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/cms.CMSType" + }, "updated_at": { "type": "integer" } } }, + "cms.CMSType": { + "type": "string", + "enum": [ + "company", + "organization" + ], + "x-enum-varnames": [ + "CMSTypeCompany", + "CMSTypeOrganization" + ] + }, "cms.card": { "type": "object", "properties": { diff --git a/cmd/web/docs/swagger.yaml b/cmd/web/docs/swagger.yaml index dc4d5e6..d57b42f 100644 --- a/cmd/web/docs/swagger.yaml +++ b/cmd/web/docs/swagger.yaml @@ -50,6 +50,10 @@ definitions: language: example: en type: string + type: + allOf: + - $ref: '#/definitions/cms.CMSType' + example: company type: object cms.CMSListResponse: properties: @@ -66,8 +70,12 @@ definitions: $ref: '#/definitions/cms.cardSection' chart: $ref: '#/definitions/cms.chartSection' + company_name: + type: string contact: $ref: '#/definitions/cms.contactSection' + country: + type: string created_at: type: integer features: @@ -80,9 +88,21 @@ definitions: type: string key: type: string + language: + type: string + type: + $ref: '#/definitions/cms.CMSType' updated_at: type: integer type: object + cms.CMSType: + enum: + - company + - organization + type: string + x-enum-varnames: + - CMSTypeCompany + - CMSTypeOrganization cms.card: properties: description: