{"record":{"id":"63fb1b06c1969181","repo":"flipped-aurora/gin-vue-admin","slug":"d-d-fielddesc","errorCode":null,"errorMessage":"模块 %d 字段 %d 的 fieldDesc 不能为空","messagePattern":"模块 (.+?) 字段 (.+?) 的 fieldDesc 不能为空","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/gva_execute.go","lineNumber":361,"sourceCode":"\t\t\tif moduleInfo.HumpPackageName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 humpPackageName 不能为空\", moduleIndex+1)\n\t\t\t}\n\t\t\tif len(moduleInfo.Fields) == 0 {\n\t\t\t\treturn fmt.Errorf(\"模块 %d 的 fields 不能为空，至少需要一个字段\", moduleIndex+1)\n\t\t\t}\n\n\t\t\tfor i, field := range moduleInfo.Fields {\n\t\t\t\tif field.FieldName == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 fieldName 不能为空\", moduleIndex+1, i+1)\n\t\t\t\t}\n\t\t\t\tif len(field.FieldName) > 0 {\n\t\t\t\t\tfirstChar := string(field.FieldName[0])\n\t\t\t\t\tif firstChar >= \"a\" && firstChar <= \"z\" {\n\t\t\t\t\t\tmoduleInfo.Fields[i].FieldName = strings.ToUpper(firstChar) + field.FieldName[1:]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif field.FieldDesc == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 fieldDesc 不能为空\", moduleIndex+1, i+1)\n\t\t\t\t}\n\t\t\t\tif field.FieldType == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 fieldType 不能为空\", moduleIndex+1, i+1)\n\t\t\t\t}\n\t\t\t\tif field.FieldJson == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 fieldJson 不能为空\", moduleIndex+1, i+1)\n\t\t\t\t}\n\t\t\t\tif field.ColumnName == \"\" {\n\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 columnName 不能为空\", moduleIndex+1, i+1)\n\t\t\t\t}\n\n\t\t\t\tvalidFieldTypes := []string{\"string\", \"int\", \"int64\", \"float64\", \"bool\", \"time.Time\", \"enum\", \"picture\", \"video\", \"file\", \"pictures\", \"array\", \"richtext\", \"json\"}\n\t\t\t\tif !slices.Contains(validFieldTypes, field.FieldType) {\n\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 fieldType '%s' 不支持\", moduleIndex+1, i+1, field.FieldType)\n\t\t\t\t}\n\n\t\t\t\tif field.FieldSearchType != \"\" {\n\t\t\t\t\tvalidSearchTypes := []string{\"=\", \"!=\", \">\", \">=\", \"<\", \"<=\", \"LIKE\", \"BETWEEN\", \"NOT BETWEEN\", \"IN\", \"NOT IN\"}","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/gva_execute.go#L343-L379","documentation":"Each field requires a non-empty FieldDesc, the human-readable description used in generated comments, front-end labels, and Swagger docs. validateExecutionPlan throws this error when fields[i].fieldDesc is empty. Note FieldName has already been normalized (first letter uppercased) before this check.","triggerScenarios":"A field entry in the execution plan missing fieldDesc or providing \"\"/null while fieldName is set.","commonSituations":"Plans where the LLM filled technical fields but skipped the description; batch-generated fields from a table dump with no column comments; users who considered descriptions optional polish.","solutions":["Add a short fieldDesc describing the field's business meaning","If generating from an existing DB, reuse the column comment as fieldDesc","Re-run gva_execute; iterate since only the first invalid field is reported per run"],"exampleFix":"// before\n{\"fieldName\":\"Name\",\"fieldDesc\":\"\",\"fieldType\":\"string\"}\n// after\n{\"fieldName\":\"Name\",\"fieldDesc\":\"article name\",\"fieldType\":\"string\"}","handlingStrategy":"validation","validationCode":"for i, m := range plan.Modules {\n  for j, f := range m.Fields {\n    if f.FieldDesc == \"\" {\n      return fmt.Errorf(\"modules[%d].fields[%d].fieldDesc is required\", i, j)\n    }\n  }\n}","typeGuard":"func hasFieldDesc(f Field) bool { return f.FieldDesc != \"\" }","tryCatchPattern":null,"preventionTips":["Reuse DB column comments as fieldDesc when generating from existing schemas","Make description a mandatory output of your plan-generation prompt","Check all fields in a module at once with a local validation script"],"tags":["mcp","code-generation","validation","fields"],"backgroundTag":"missing-required-field","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}