{"record":{"id":"3bf7a3b4b6aafd51","repo":"larksuite/cli","slug":"l2-field-q-enumdescriptions-length-d-enum","errorCode":null,"errorMessage":"L2: field %q enumDescriptions length (%d) != enum length (%d)","messagePattern":"L2: field %q enumDescriptions length \\((.+?)\\) != enum length \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/schema/lint.go","lineNumber":129,"sourceCode":"\n// walkForL2 recursively applies per-field L2 checks (format:binary on\n// non-string; minimum>=maximum) plus the sub-object required-exists invariant.\n// Required only matters on object-typed Properties (e.g. the params / data\n// wrappers); leaf scalars ignore it.\nfunc walkForL2(props *OrderedProps, errs *[]error) {\n\tif props == nil {\n\t\treturn\n\t}\n\tfor _, k := range props.Order {\n\t\tp := props.Map[k]\n\t\tif p.Format == \"binary\" && p.Type != \"string\" {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"L2: field %q has format: binary but type = %q (want string)\", k, p.Type))\n\t\t}\n\t\tif p.Minimum != nil && p.Maximum != nil && *p.Minimum >= *p.Maximum {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"L2: field %q minimum (%v) >= maximum (%v)\", k, *p.Minimum, *p.Maximum))\n\t\t}\n\t\tif n := len(p.EnumDescriptions); n > 0 && n != len(p.Enum) {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"L2: field %q enumDescriptions length (%d) != enum length (%d)\", k, n, len(p.Enum)))\n\t\t}\n\t\tif len(p.Required) > 0 && p.Properties != nil {\n\t\t\tfor _, r := range p.Required {\n\t\t\t\tif _, ok := p.Properties.Map[r]; !ok {\n\t\t\t\t\t*errs = append(*errs, fmt.Errorf(\"L2: required key %q in %q not found in its properties\", r, k))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif p.Properties != nil {\n\t\t\twalkForL2(p.Properties, errs)\n\t\t}\n\t}\n}\n\n// validatePropertyTypes walks an OrderedProps tree and asserts:\n//   - every Property.Type is in validJSONSchemaTypes (or empty for nested objects with only properties)\n//   - array Properties have Items\n//","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/schema/lint.go#L111-L147","documentation":"L2 schema lint failure: a field's enumDescriptions array length does not match its enum array length. Every enum value must have exactly one description for help/schema rendering.","triggerScenarios":"A property p has len(p.EnumDescriptions) > 0 and that count differs from len(p.Enum) — an enum value added/removed without updating descriptions, or vice versa.","commonSituations":"Adding a new enum value from refreshed upstream metadata without adding a description; deleting a description for an undocumented value; hand-editing either array.","solutions":["Add or remove enumDescriptions entries so len matches len(enum)","Remove enumDescriptions entirely if no descriptions are wanted (empty is allowed)","Regenerate the schema from the upstream metadata so both arrays stay in sync"],"exampleFix":"// before\nEnum: [\"a\",\"b\",\"c\"], EnumDescriptions: [\"A\",\"B\"]\n// after\nEnum: [\"a\",\"b\",\"c\"], EnumDescriptions: [\"A\",\"B\",\"C\"]","handlingStrategy":"validation","validationCode":"if len(p.EnumDescriptions) > 0 && len(p.EnumDescriptions) != len(p.Enum) {\n  return fmt.Errorf(\"field %s: %d descriptions for %d enum values\", name, len(p.EnumDescriptions), len(p.Enum))\n}","typeGuard":"func enumDescriptionsAligned(p *Property) bool { return len(p.EnumDescriptions) == 0 || len(p.EnumDescriptions) == len(p.Enum) }","tryCatchPattern":null,"preventionTips":["Update enum and enumDescriptions in the same edit","Generate descriptions from the same source as enum values","Drop enumDescriptions entirely if descriptions are unknown (empty is valid)"],"tags":["json-schema","lint","enum"],"backgroundTag":"schema-validation-failed","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"}