larksuite/cli · error

L1: array property %q items has invalid type %q

Error message

L1: array property %q items has invalid type %q

What it means

validateItemSchema checks the array element schema itself (not just child properties): items.type is set but is not one of the valid JSON Schema types, e.g. `items.type = "list"` - precisely the gap this per-element validation closes.

Source

Thrown at internal/schema/lint.go:177

			*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))
	}
	if item.Type == "array" && item.Items == nil {
		*errs = append(*errs, fmt.Errorf("L1: array property %q items (nested array) missing items", parentKey))
	}
	if item.Properties != nil {
		validatePropertyTypes(item.Properties, errs)
	}
	if item.Items != nil {
		validateItemSchema(parentKey, item.Items, errs)
	}
}

// coverageBaseline is the per-metric warn threshold for L4 coverage checks.
// If the measured rate drops below the baseline, t.Logf emits a warning but
// does NOT fail the test. Adjust these constants upward as meta_data quality
// improves over time.
var coverageBaseline = map[string]float64{
	"description": 0.99,

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Fix the item type to a valid JSON Schema type (string, number, integer, boolean, array, object)
  2. Remove the invalid Type if elements are untyped
  3. Fix the generator that emitted the element schema

Example fix

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

Strategy: type-guard

Validate before calling

if item.Type != "" && !validJSONSchemaTypes[item.Type] {
  return fmt.Errorf("items of %s have invalid type %q", parentKey, item.Type)
}

Type guard

func hasValidItemType(item *Property) bool { return item.Type == "" || validJSONSchemaTypes[item.Type] }

Prevention

When it happens

Trigger: validateItemSchema is invoked (from validatePropertyTypes for an array property, or recursively for nested items) with item.Type non-empty and not in validJSONSchemaTypes — e.g. array of elements typed "list".

Common situations: Typo in an element type; assuming Go types carry over; nested arrays where the inner items type was mistyped.

Related errors


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