larksuite/cli · error

L1: property %q has invalid type %q

Error message

L1: property %q has invalid type %q

What it means

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.

Source

Thrown at internal/schema/lint.go:156

		if p.Properties != nil {
			walkForL2(p.Properties, errs)
		}
	}
}

// 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.

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Replace with a valid JSON Schema type: string, number, integer, boolean, array, object
  2. Fix the typo in the type name
  3. Leave Type empty if the property is intentionally untyped
  4. Check validJSONSchemaTypes in internal/schema for the allowed set

Example fix

// before
Property{Type: "int"}
// after
Property{Type: "integer"}
Defensive patterns

Strategy: type-guard

Validate before calling

var validJSONSchemaTypes = map[string]bool{
  "string": true, "number": true, "integer": true,
  "boolean": true, "array": true, "object": true,
}
if p.Type != "" && !validJSONSchemaTypes[p.Type] {
  return fmt.Errorf("property %s has invalid type %q", name, p.Type)
}

Type guard

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

Prevention

When it happens

Trigger: validatePropertyTypes (recursively, and via validateItemSchema's recursion into nested properties) sees p.Type non-empty and not in validJSONSchemaTypes — e.g. "str", "int", "boolean[]".

Common situations: Hand-written schema with Go-ish type names instead of JSON Schema names; generator emitting lowercase mismatches; typos like "sring".

Related errors


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