{"record":{"id":"7a083b305de757c3","repo":"larksuite/cli","slug":"s-field-s-has-unsupported-json-option-q","errorCode":null,"errorMessage":"%s field %s has unsupported json option %q","messagePattern":"(.+?) field (.+?) has unsupported json option %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_data.go","lineNumber":220,"sourceCode":"\t\tif !ok {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s must declare json tag\", path, field.Name)\n\t\t}\n\t\tparts := strings.Split(rawJSON, \",\")\n\t\tname := parts[0]\n\t\tif name == \"-\" {\n\t\t\tcontinue\n\t\t}\n\t\tif name == \"\" {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s json tag must explicitly name the field\", path, field.Name)\n\t\t}\n\t\tomitempty := false\n\t\tfor _, option := range parts[1:] {\n\t\t\tswitch option {\n\t\t\tcase \"omitempty\":\n\t\t\t\tomitempty = true\n\t\t\tcase \"\":\n\t\t\tdefault:\n\t\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s has unsupported json option %q\", path, field.Name, option)\n\t\t\t}\n\t\t}\n\t\tif previous, exists := seen[name]; exists {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s JSON name %q duplicates field %s\", path, field.Name, name, previous)\n\t\t}\n\t\tseen[name] = field.Name\n\t\tschema, err := parseSchemaTag(field.Tag.Get(\"schema\"), field.Type, input)\n\t\tif err != nil {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): %w\", path, field.Name, name, err)\n\t\t}\n\t\tif !input && schema.defaultValue.Set {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): Data field cannot declare default\", path, field.Name, name)\n\t\t}\n\t\tif schema.required && omitempty {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): required Data field cannot use omitempty\", path, field.Name, name)\n\t\t}\n\t\tif schema.optional && !omitempty {\n\t\t\treturn typedObjectShape{}, fmt.Errorf(\"%s field %s (%s): optional Data field must use omitempty\", path, field.Name, name)","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_data.go#L202-L238","documentation":"A `json` tag on a struct field contained an option other than `omitempty` (or an empty option slot). The typed data compiler only supports `omitempty` as a tag option, so options like `string`, `minimize`, or unknown names are rejected to keep compiled schema semantics fully defined.","triggerScenarios":"A field tagged e.g. `json:\"name,omitempty,string\"` or `json:\"name,minimize\"` compiled through compileStructShape.","commonSituations":"Copying tags from code that uses Go 1.21+ `omitempty` variants or third-party JSON libraries (`string`, `minimize`); typos such as `omitemptyx`; hand-written tags with stray extra words.","solutions":["Remove the unsupported option, keeping only the name (and `omitempty` if the field is optional)","Fix typos in `omitempty`","If the option encodes schema behavior (e.g. string rendering), express it via the separate `schema:` tag instead"],"exampleFix":"// before\nAmount int `json:\"amount,string\"`\n// after\nAmount int `json:\"amount\" schema:\"required\" doc:\"...\"`","handlingStrategy":"validation","validationCode":"for i := 0; i < t.NumField(); i++ {\n    f := t.Field(i)\n    for _, opt := range strings.Split(f.Tag.Get(\"json\"), \",\")[1:] {\n        switch opt {\n        case \"\", \"omitempty\":\n        default:\n            return fmt.Errorf(\"field %s has unsupported json option %q\", f.Name, opt)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Limit json tag options to omitempty in typed structs","Move non-serialization semantics into the schema: tag","Grep code for `,string\"` or other option patterns before compiling"],"tags":["go","struct-tags","json","schema-compile"],"backgroundTag":"unsupported-json-tag-option","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}