update question validate

This commit is contained in:
aichy126 2023-02-02 16:39:51 +08:00
parent 052ec0ceb0
commit c10dfb9884
4 changed files with 25 additions and 140 deletions

View File

@ -5464,8 +5464,7 @@ const docTemplate = `{
"type": "object",
"required": [
"object_id",
"original_text",
"parsed_text"
"original_text"
],
"properties": {
"mention_username_list": {
@ -5481,11 +5480,9 @@ const docTemplate = `{
},
"original_text": {
"description": "original comment content",
"type": "string"
},
"parsed_text": {
"description": "parsed comment content",
"type": "string"
"type": "string",
"maxLength": 600,
"minLength": 2
},
"reply_comment_id": {
"description": "reply comment id",
@ -5579,17 +5576,11 @@ const docTemplate = `{
],
"properties": {
"content": {
"description": "content",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"html": {
"description": "html",
"type": "string"
},
"question_id": {
"description": "question_id",
"type": "string"
}
}
@ -5601,29 +5592,20 @@ const docTemplate = `{
],
"properties": {
"content": {
"description": "content",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"edit_summary": {
"description": "edit_summary",
"type": "string"
},
"html": {
"description": "html",
"type": "string"
},
"id": {
"description": "id",
"type": "string"
},
"question_id": {
"description": "question_id",
"type": "string"
},
"title": {
"description": "title",
"type": "string"
}
}
@ -6650,7 +6632,6 @@ const docTemplate = `{
"type": "object",
"required": [
"content",
"html",
"tags",
"title"
],
@ -6661,12 +6642,6 @@ const docTemplate = `{
"maxLength": 65535,
"minLength": 6
},
"html": {
"description": "html",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"tags": {
"description": "tags",
"type": "array",
@ -6799,7 +6774,6 @@ const docTemplate = `{
"type": "object",
"required": [
"content",
"html",
"id",
"tags",
"title"
@ -6815,12 +6789,6 @@ const docTemplate = `{
"description": "edit summary",
"type": "string"
},
"html": {
"description": "html",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"id": {
"description": "question id",
"type": "string"
@ -7386,10 +7354,6 @@ const docTemplate = `{
"description": "original text",
"type": "string"
},
"parsed_text": {
"description": "parsed text",
"type": "string"
},
"slug_name": {
"description": "slug_name",
"type": "string",
@ -7476,7 +7440,8 @@ const docTemplate = `{
"schema.UpdateCommentReq": {
"type": "object",
"required": [
"comment_id"
"comment_id",
"original_text"
],
"properties": {
"comment_id": {
@ -7485,11 +7450,9 @@ const docTemplate = `{
},
"original_text": {
"description": "original comment content",
"type": "string"
},
"parsed_text": {
"description": "parsed comment content",
"type": "string"
"type": "string",
"maxLength": 600,
"minLength": 2
}
}
},
@ -7604,10 +7567,6 @@ const docTemplate = `{
"description": "original text",
"type": "string"
},
"parsed_text": {
"description": "parsed text",
"type": "string"
},
"slug_name": {
"description": "slug_name",
"type": "string",

View File

@ -5452,8 +5452,7 @@
"type": "object",
"required": [
"object_id",
"original_text",
"parsed_text"
"original_text"
],
"properties": {
"mention_username_list": {
@ -5469,11 +5468,9 @@
},
"original_text": {
"description": "original comment content",
"type": "string"
},
"parsed_text": {
"description": "parsed comment content",
"type": "string"
"type": "string",
"maxLength": 600,
"minLength": 2
},
"reply_comment_id": {
"description": "reply comment id",
@ -5567,17 +5564,11 @@
],
"properties": {
"content": {
"description": "content",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"html": {
"description": "html",
"type": "string"
},
"question_id": {
"description": "question_id",
"type": "string"
}
}
@ -5589,29 +5580,20 @@
],
"properties": {
"content": {
"description": "content",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"edit_summary": {
"description": "edit_summary",
"type": "string"
},
"html": {
"description": "html",
"type": "string"
},
"id": {
"description": "id",
"type": "string"
},
"question_id": {
"description": "question_id",
"type": "string"
},
"title": {
"description": "title",
"type": "string"
}
}
@ -6638,7 +6620,6 @@
"type": "object",
"required": [
"content",
"html",
"tags",
"title"
],
@ -6649,12 +6630,6 @@
"maxLength": 65535,
"minLength": 6
},
"html": {
"description": "html",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"tags": {
"description": "tags",
"type": "array",
@ -6787,7 +6762,6 @@
"type": "object",
"required": [
"content",
"html",
"id",
"tags",
"title"
@ -6803,12 +6777,6 @@
"description": "edit summary",
"type": "string"
},
"html": {
"description": "html",
"type": "string",
"maxLength": 65535,
"minLength": 6
},
"id": {
"description": "question id",
"type": "string"
@ -7374,10 +7342,6 @@
"description": "original text",
"type": "string"
},
"parsed_text": {
"description": "parsed text",
"type": "string"
},
"slug_name": {
"description": "slug_name",
"type": "string",
@ -7464,7 +7428,8 @@
"schema.UpdateCommentReq": {
"type": "object",
"required": [
"comment_id"
"comment_id",
"original_text"
],
"properties": {
"comment_id": {
@ -7473,11 +7438,9 @@
},
"original_text": {
"description": "original comment content",
"type": "string"
},
"parsed_text": {
"description": "parsed comment content",
"type": "string"
"type": "string",
"maxLength": 600,
"minLength": 2
}
}
},
@ -7592,10 +7555,6 @@
"description": "original text",
"type": "string"
},
"parsed_text": {
"description": "parsed text",
"type": "string"
},
"slug_name": {
"description": "slug_name",
"type": "string",

View File

@ -147,9 +147,8 @@ definitions:
type: string
original_text:
description: original comment content
type: string
parsed_text:
description: parsed comment content
maxLength: 600
minLength: 2
type: string
reply_comment_id:
description: reply comment id
@ -157,7 +156,6 @@ definitions:
required:
- object_id
- original_text
- parsed_text
type: object
schema.AddReportReq:
properties:
@ -217,15 +215,10 @@ definitions:
schema.AnswerAddReq:
properties:
content:
description: content
maxLength: 65535
minLength: 6
type: string
html:
description: html
type: string
question_id:
description: question_id
type: string
required:
- content
@ -233,24 +226,16 @@ definitions:
schema.AnswerUpdateReq:
properties:
content:
description: content
maxLength: 65535
minLength: 6
type: string
edit_summary:
description: edit_summary
type: string
html:
description: html
type: string
id:
description: id
type: string
question_id:
description: question_id
type: string
title:
description: title
type: string
required:
- content
@ -996,11 +981,6 @@ definitions:
maxLength: 65535
minLength: 6
type: string
html:
description: html
maxLength: 65535
minLength: 6
type: string
tags:
description: tags
items:
@ -1013,7 +993,6 @@ definitions:
type: string
required:
- content
- html
- tags
- title
type: object
@ -1105,11 +1084,6 @@ definitions:
edit_summary:
description: edit summary
type: string
html:
description: html
maxLength: 65535
minLength: 6
type: string
id:
description: question id
type: string
@ -1125,7 +1099,6 @@ definitions:
type: string
required:
- content
- html
- id
- tags
- title
@ -1505,9 +1478,6 @@ definitions:
original_text:
description: original text
type: string
parsed_text:
description: parsed text
type: string
slug_name:
description: slug_name
maxLength: 35
@ -1573,12 +1543,12 @@ definitions:
type: string
original_text:
description: original comment content
type: string
parsed_text:
description: parsed comment content
maxLength: 600
minLength: 2
type: string
required:
- comment_id
- original_text
type: object
schema.UpdateFollowTagsReq:
properties:
@ -1659,9 +1629,6 @@ definitions:
original_text:
description: original text
type: string
parsed_text:
description: parsed text
type: string
slug_name:
description: slug_name
maxLength: 35

View File

@ -43,7 +43,7 @@ type QuestionAdd struct {
// question title
Title string `validate:"required,gte=6,lte=150" json:"title"`
// content
Content string `validate:"required,gte=6,lte=65535" json:"content"`
Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
// html
HTML string `json:"-"`
// tags
@ -92,7 +92,7 @@ type QuestionUpdate struct {
// question title
Title string `validate:"required,gte=6,lte=150" json:"title"`
// content
Content string `validate:"required,gte=6,lte=65535" json:"content"`
Content string `validate:"required,notblank,gte=6,lte=65535" json:"content"`
// html
HTML string `json:"-"`
// tags