{"record":{"id":"683d4fb893265f16","repo":"larksuite/cli","slug":"l1-property-q-has-invalid-type-q","errorCode":null,"errorMessage":"L1: property %q has invalid type %q","messagePattern":"L1: property %q has invalid type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/schema/lint.go","lineNumber":156,"sourceCode":"\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//\n// Errors are appended to *errs.\nfunc validatePropertyTypes(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.Type != \"\" && !validJSONSchemaTypes[p.Type] {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"L1: property %q has invalid type %q\", k, p.Type))\n\t\t}\n\t\tif p.Type == \"array\" && p.Items == nil {\n\t\t\t*errs = append(*errs, fmt.Errorf(\"L1: array property %q missing items\", k))\n\t\t}\n\t\tif p.Properties != nil {\n\t\t\tvalidatePropertyTypes(p.Properties, errs)\n\t\t}\n\t\t// Validate the array-element schema itself, not only its child\n\t\t// properties — a primitive element with an invalid type (e.g.\n\t\t// `items.type = \"list\"`) would otherwise slip past lint.\n\t\tif p.Items != nil {\n\t\t\tvalidateItemSchema(k, p.Items, errs)\n\t\t}\n\t}\n}\n\n// validateItemSchema checks a single array element schema for invalid types,\n// then recurses into any further nested properties/items.","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/schema/lint.go#L138-L174","documentation":"L1 structural check in validatePropertyTypes: every property with a non-empty Type must be one of the valid JSON Schema types (via validJSONSchemaTypes). Catches misspelled or invented type names in schema envelopes.","triggerScenarios":"validatePropertyTypes (recursively, and via validateItemSchema's recursion into nested properties) sees p.Type non-empty and not in validJSONSchemaTypes — e.g. \"str\", \"int\", \"boolean[]\".","commonSituations":"Hand-written schema with Go-ish type names instead of JSON Schema names; generator emitting lowercase mismatches; typos like \"sring\".","solutions":["Replace with a valid JSON Schema type: string, number, integer, boolean, array, object","Fix the typo in the type name","Leave Type empty if the property is intentionally untyped","Check validJSONSchemaTypes in internal/schema for the allowed set"],"exampleFix":"// before\nProperty{Type: \"int\"}\n// after\nProperty{Type: \"integer\"}","handlingStrategy":"type-guard","validationCode":"var validJSONSchemaTypes = map[string]bool{\n  \"string\": true, \"number\": true, \"integer\": true,\n  \"boolean\": true, \"array\": true, \"object\": true,\n}\nif p.Type != \"\" && !validJSONSchemaTypes[p.Type] {\n  return fmt.Errorf(\"property %s has invalid type %q\", name, p.Type)\n}","typeGuard":"func hasValidJSONSchemaType(p *Property) bool { return p.Type == \"\" || validJSONSchemaTypes[p.Type] }","tryCatchPattern":null,"preventionTips":["Use only JSON Schema type names: string, number, integer, boolean, array, object","Never map Go type names (int, float) directly into schemas","Run go test ./internal/schema before committing schema changes"],"tags":["json-schema","lint","type"],"backgroundTag":"json-schema-type-mismatch","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"}