{"record":{"id":"45fae03b2f9b7545","repo":"flipped-aurora/gin-vue-admin","slug":"d-d-fieldsearchtype-s","errorCode":null,"errorMessage":"模块 %d 字段 %d 的 fieldSearchType '%s' 不支持","messagePattern":"模块 (.+?) 字段 (.+?) 的 fieldSearchType '(.+?)' 不支持","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/gva_execute.go","lineNumber":381,"sourceCode":"\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\"}\n\t\t\t\t\tif !slices.Contains(validSearchTypes, field.FieldSearchType) {\n\t\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 fieldSearchType '%s' 不支持\", moduleIndex+1, i+1, field.FieldSearchType)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif field.DataSource != nil {\n\t\t\t\t\tassociationValue := field.DataSource.Association\n\t\t\t\t\tif associationValue == 2 && field.FieldType != \"array\" {\n\t\t\t\t\t\tlogger.WithCtx(ctx).Mod(\"mcp\").Info(fmt.Sprintf(\"module %d field %d association=2, force fieldType to array\", moduleIndex+1, i+1))\n\t\t\t\t\t\tmoduleInfo.Fields[i].FieldType = \"array\"\n\t\t\t\t\t}\n\t\t\t\t\tif associationValue != 1 && associationValue != 2 {\n\t\t\t\t\t\treturn fmt.Errorf(\"模块 %d 字段 %d 的 dataSource.association 必须是 1 或 2\", moduleIndex+1, i+1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !moduleInfo.GvaModel {\n\t\t\t\tprimaryKeyCount := 0\n\t\t\t\tfor _, field := range moduleInfo.Fields {","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/gva_execute.go#L363-L399","documentation":"If a field declares fieldSearchType (the query condition generated for the list/search UI), it must be one of the supported operators: =, !=, >, >=, <, <=, LIKE, BETWEEN, NOT BETWEEN, IN, NOT IN. Empty means 'no search' and is allowed; anything non-empty and outside the list is rejected.","triggerScenarios":"Plan field has fieldSearchType set to a value like 'like' (wrong case), '~', 'REGEXP', 'contains', or a misspelled operator.","commonSituations":"LLM emits lowercase 'like'/'in' instead of 'LIKE'/'IN'; copy-paste from another framework's query operators; hand-written plan using free-text condition names.","solutions":["Use exactly one of: =, !=, >, >=, <, <=, LIKE, BETWEEN, NOT BETWEEN, IN, NOT IN (case-sensitive)","Remove fieldSearchType entirely if the field should not be searchable","Normalize operator casing when generating plans (e.g. strings.ToUpper for keyword operators)"],"exampleFix":"// before\n{\"fieldJson\":\"name\",\"fieldType\":\"string\",\"columnName\":\"name\",\"fieldSearchType\":\"like\"}\n// after\n{\"fieldJson\":\"name\",\"fieldType\":\"string\",\"columnName\":\"name\",\"fieldSearchType\":\"LIKE\"}","handlingStrategy":"validation","validationCode":"var validSearchTypes = []string{\"=\",\"!=\",\">\",\">=\",\"<\",\"<=\",\"LIKE\",\"BETWEEN\",\"NOT BETWEEN\",\"IN\",\"NOT IN\"}\nif f.FieldSearchType != \"\" && !slices.Contains(validSearchTypes, f.FieldSearchType) { return fmt.Errorf(\"bad searchType %q\", f.FieldSearchType) }","typeGuard":"func isSupportedSearchType(s string) bool {\n  return s == \"\" || slices.Contains([]string{\"=\",\"!=\",\">\",\">=\",\"<\",\"<=\",\"LIKE\",\"BETWEEN\",\"NOT BETWEEN\",\"IN\",\"NOT IN\"}, s)\n}","tryCatchPattern":null,"preventionTips":["Use uppercase keyword operators exactly as whitelisted","Leave fieldSearchType empty when search is not needed","Centralize operator constants shared between client and validator"],"tags":["validation","query-operator","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}