This is an automated email from the ASF dual-hosted git repository.
kumfo pushed a commit to branch feat/1.8.0/menu
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/feat/1.8.0/menu by this push:
new 94de2136 feat(menu): update schema to remove deprecated min_tags and
add MinimumTags to SiteQuestionsReq
94de2136 is described below
commit 94de21361e60c4653c229f0d3ad14fa8f0f58cf9
Author: kumfo <[email protected]>
AuthorDate: Wed Jan 21 16:29:08 2026 +0800
feat(menu): update schema to remove deprecated min_tags and add MinimumTags
to SiteQuestionsReq
---
docs/docs.go | 27 +++++++++++----------------
docs/swagger.json | 27 +++++++++++----------------
docs/swagger.yaml | 20 +++++++++-----------
internal/migrations/v30.go | 2 +-
internal/schema/siteinfo_schema.go | 3 ++-
internal/service/tag_common/tag_common.go | 2 +-
6 files changed, 35 insertions(+), 46 deletions(-)
diff --git a/docs/docs.go b/docs/docs.go
index a70cdab0..c624133b 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -10982,12 +10982,7 @@ const docTemplate = `{
"$ref": "#/definitions/schema.SiteInterfaceSettingsResp"
},
"login": {
- "description": "todo",
- "allOf": [
- {
- "$ref": "#/definitions/schema.SiteLoginResp"
- }
- ]
+ "$ref": "#/definitions/schema.SiteLoginResp"
},
"revision": {
"type": "string"
@@ -11163,6 +11158,11 @@ const docTemplate = `{
"maximum": 65535,
"minimum": 0
},
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
"restrict_answer": {
"type": "boolean"
}
@@ -11176,6 +11176,11 @@ const docTemplate = `{
"maximum": 65535,
"minimum": 0
},
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
"restrict_answer": {
"type": "boolean"
}
@@ -11260,11 +11265,6 @@ const docTemplate = `{
"schema.SiteTagsReq": {
"type": "object",
"properties": {
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
"recommend_tags": {
"type": "array",
"items": {
@@ -11285,11 +11285,6 @@ const docTemplate = `{
"schema.SiteTagsResp": {
"type": "object",
"properties": {
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
"recommend_tags": {
"type": "array",
"items": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 05e3302c..58f38579 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -10974,12 +10974,7 @@
"$ref": "#/definitions/schema.SiteInterfaceSettingsResp"
},
"login": {
- "description": "todo",
- "allOf": [
- {
- "$ref": "#/definitions/schema.SiteLoginResp"
- }
- ]
+ "$ref": "#/definitions/schema.SiteLoginResp"
},
"revision": {
"type": "string"
@@ -11155,6 +11150,11 @@
"maximum": 65535,
"minimum": 0
},
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
"restrict_answer": {
"type": "boolean"
}
@@ -11168,6 +11168,11 @@
"maximum": 65535,
"minimum": 0
},
+ "min_tags": {
+ "type": "integer",
+ "maximum": 5,
+ "minimum": 0
+ },
"restrict_answer": {
"type": "boolean"
}
@@ -11252,11 +11257,6 @@
"schema.SiteTagsReq": {
"type": "object",
"properties": {
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
"recommend_tags": {
"type": "array",
"items": {
@@ -11277,11 +11277,6 @@
"schema.SiteTagsResp": {
"type": "object",
"properties": {
- "min_tags": {
- "type": "integer",
- "maximum": 5,
- "minimum": 0
- },
"recommend_tags": {
"type": "array",
"items": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 85a05baf..39235a33 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -2210,9 +2210,7 @@ definitions:
interface:
$ref: '#/definitions/schema.SiteInterfaceSettingsResp'
login:
- allOf:
- - $ref: '#/definitions/schema.SiteLoginResp'
- description: todo
+ $ref: '#/definitions/schema.SiteLoginResp'
revision:
type: string
site_advanced:
@@ -2330,6 +2328,10 @@ definitions:
maximum: 65535
minimum: 0
type: integer
+ min_tags:
+ maximum: 5
+ minimum: 0
+ type: integer
restrict_answer:
type: boolean
type: object
@@ -2339,6 +2341,10 @@ definitions:
maximum: 65535
minimum: 0
type: integer
+ min_tags:
+ maximum: 5
+ minimum: 0
+ type: integer
restrict_answer:
type: boolean
type: object
@@ -2396,10 +2402,6 @@ definitions:
type: object
schema.SiteTagsReq:
properties:
- min_tags:
- maximum: 5
- minimum: 0
- type: integer
recommend_tags:
items:
$ref: '#/definitions/schema.SiteWriteTag'
@@ -2413,10 +2415,6 @@ definitions:
type: object
schema.SiteTagsResp:
properties:
- min_tags:
- maximum: 5
- minimum: 0
- type: integer
recommend_tags:
items:
$ref: '#/definitions/schema.SiteWriteTag'
diff --git a/internal/migrations/v30.go b/internal/migrations/v30.go
index c73f501d..aa2f48b3 100644
--- a/internal/migrations/v30.go
+++ b/internal/migrations/v30.go
@@ -80,6 +80,7 @@ func splitWriteMenu(ctx context.Context, x *xorm.Engine)
error {
}
// site questions settings
siteQuestions := &schema.SiteQuestionsResp{
+ MinimumTags: siteWrite.MinimumTags,
MinimumContent: siteWrite.MinimumContent,
RestrictAnswer: siteWrite.RestrictAnswer,
}
@@ -87,7 +88,6 @@ func splitWriteMenu(ctx context.Context, x *xorm.Engine)
error {
siteTags := &schema.SiteTagsResp{
ReservedTags: siteWrite.ReservedTags,
RecommendTags: siteWrite.RecommendTags,
- MinimumTags: siteWrite.MinimumTags,
RequiredTag: siteWrite.RequiredTag,
}
diff --git a/internal/schema/siteinfo_schema.go
b/internal/schema/siteinfo_schema.go
index 563b0cc1..b2d2c4b3 100644
--- a/internal/schema/siteinfo_schema.go
+++ b/internal/schema/siteinfo_schema.go
@@ -88,6 +88,7 @@ type SiteBrandingReq struct {
}
// SiteWriteReq site write request
+// Deprecated: use SiteQuestionsReq, SiteAdvancedReq and SiteTagsReq instead
type SiteWriteReq struct {
MinimumContent int
`validate:"omitempty,gte=0,lte=65535" json:"min_content"`
RestrictAnswer bool `validate:"omitempty"
json:"restrict_answer"`
@@ -107,6 +108,7 @@ type SiteWriteResp SiteWriteReq
// SiteQuestionsReq site questions settings request
type SiteQuestionsReq struct {
+ MinimumTags int `validate:"omitempty,gte=0,lte=5" json:"min_tags"`
MinimumContent int `validate:"omitempty,gte=0,lte=65535"
json:"min_content"`
RestrictAnswer bool `validate:"omitempty" json:"restrict_answer"`
}
@@ -124,7 +126,6 @@ type SiteAdvancedReq struct {
type SiteTagsReq struct {
ReservedTags []*SiteWriteTag `validate:"omitempty,dive"
json:"reserved_tags"`
RecommendTags []*SiteWriteTag `validate:"omitempty,dive"
json:"recommend_tags"`
- MinimumTags int `validate:"omitempty,gte=0,lte=5"
json:"min_tags"`
RequiredTag bool `validate:"omitempty" json:"required_tag"`
UserID string `json:"-"`
}
diff --git a/internal/service/tag_common/tag_common.go
b/internal/service/tag_common/tag_common.go
index 0da9f6fd..87b53f39 100644
--- a/internal/service/tag_common/tag_common.go
+++ b/internal/service/tag_common/tag_common.go
@@ -295,7 +295,7 @@ func (ts *TagCommonService) ExistRecommend(ctx
context.Context, tags []*schema.T
}
func (ts *TagCommonService) GetMinimumTags(ctx context.Context) (int, error) {
- siteInfo, err := ts.siteInfoService.GetSiteTag(ctx)
+ siteInfo, err := ts.siteInfoService.GetSiteQuestion(ctx)
if err != nil {
return 1, err
}