larksuite/cli · error

L1: array property %q missing items

Error message

L1: array property %q missing items

What it means

L1 schema lint failure: a property with type "array" lacks an items schema. Every array property must describe its element type for generated schemas to be valid.

Source

Thrown at internal/schema/lint.go:159

	}
}

// validatePropertyTypes walks an OrderedProps tree and asserts:
//   - every Property.Type is in validJSONSchemaTypes (or empty for nested objects with only properties)
//   - array Properties have Items
//
// Errors are appended to *errs.
func validatePropertyTypes(props *OrderedProps, errs *[]error) {
	if props == nil {
		return
	}
	for _, k := range props.Order {
		p := props.Map[k]
		if p.Type != "" && !validJSONSchemaTypes[p.Type] {
			*errs = append(*errs, fmt.Errorf("L1: property %q has invalid type %q", k, p.Type))
		}
		if p.Type == "array" && p.Items == nil {
			*errs = append(*errs, fmt.Errorf("L1: array property %q missing items", k))
		}
		if p.Properties != nil {
			validatePropertyTypes(p.Properties, errs)
		}
		// Validate the array-element schema itself, not only its child
		// properties — a primitive element with an invalid type (e.g.
		// `items.type = "list"`) would otherwise slip past lint.
		if p.Items != nil {
			validateItemSchema(k, p.Items, errs)
		}
	}
}

// validateItemSchema checks a single array element schema for invalid types,
// then recurses into any further nested properties/items.
func validateItemSchema(parentKey string, item *Property, errs *[]error) {
	if item.Type != "" && !validJSONSchemaTypes[item.Type] {
		*errs = append(*errs, fmt.Errorf("L1: array property %q items has invalid type %q", parentKey, item.Type))

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Add an Items schema (e.g. &Property{Type: "string"}) to the array property
  2. Change the type if the field is not really an array
  3. Regenerate the schema from upstream metadata including element types

Example fix

// before
Property{Type: "array"}
// after
Property{Type: "array", Items: &Property{Type: "string"}}
Defensive patterns

Strategy: type-guard

Validate before calling

if p.Type == "array" && p.Items == nil {
  return fmt.Errorf("array property %s missing items", name)
}

Type guard

func isWellFormedArray(p *Property) bool { return p.Type != "array" || p.Items != nil }

Prevention

When it happens

Trigger: p.Type == "array" and p.Items == nil — an array field declared without an items schema at any nesting depth.

Common situations: Declaring list parameters hastily; converting a string field to an array without adding items; generators that emit type:array and forget items.

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/48ead759d6beb612. Report an issue: GitHub.