{"record":{"id":"3d9effc17e089930","repo":"windmill-labs/windmill","slug":"array-type-should-have-field-items","errorCode":null,"errorMessage":"Array type should have field `items`","messagePattern":"Array type should have field `items`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-common/src/schema.rs","lineNumber":129,"sourceCode":"\n                    schema_rules.push(SchemaValidationRule::IsOneOf(rules_map))\n                } else {\n                    let is_resource = val\n                        .get(\"format\")\n                        .and_then(|f| f.as_str())\n                        .map(|f| f.starts_with(\"resource\"))\n                        .unwrap_or(false);\n                    if !is_resource {\n                        return Err(anyhow!(\n                        \"Object type should have a `properties` or `anyOf` field, or be a resource\"\n                        ));\n                    }\n                }\n            }\n            JsonPrimitiveType::Array => {\n                let items = val\n                    .get(\"items\")\n                    .ok_or(anyhow!(\"Array type should have field `items`\"))?;\n\n                let arr_rules = SchemaValidationRule::from_value(items)?;\n\n                schema_rules.push(SchemaValidationRule::IsArray(arr_rules));\n            }\n            JsonPrimitiveType::Boolean => {\n                schema_rules.push(SchemaValidationRule::IsBool);\n            }\n            JsonPrimitiveType::Null => {\n                schema_rules.push(SchemaValidationRule::IsNull);\n            }\n        }\n\n        Ok(schema_rules)\n    }\n\n    fn from_value(val: &Value) -> Result<Vec<Self>, Error> {\n        if let Some(any_of) = val.get(\"anyOf\").and_then(|any_of| any_of.as_array()) {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-common/src/schema.rs#L111-L147","documentation":"For array-typed schemas, Windmill requires an `items` schema describing the array elements, since it recursively builds validation rules from it. An array type without `items` cannot be validated and parsing fails.","triggerScenarios":"Declaring `\"type\": \"array\"` in an input/output schema without an `items` key, e.g. `{ \"type\": \"array\" }`.","commonSituations":"Schemas generated by tools that omit `items` for untyped arrays; hand-written schemas; downgrading from a schema editor that strips empty `items`.","solutions":["Add an `items` schema (even a permissive one such as `{}` if the parser allows it, or a concrete primitive).","If elements are truly arbitrary, type the field as a JSON value/string or give `items` an object schema with `properties`.","Validate the schema with a JSON Schema tool before deploying."],"exampleFix":"// before\n{ \"type\": \"array\" }\n// after\n{ \"type\": \"array\", \"items\": { \"type\": \"string\" } }","handlingStrategy":"validation","validationCode":"const s = JSON.parse(schemaRaw);\nif (s.type === \"array\" && !(\"items\" in s)) {\n  throw new Error(\"Array schema must declare `items`\");\n}","typeGuard":"function isWellFormedArraySchema(s) {\n  return s?.type !== \"array\" || \"items\" in s;\n}","tryCatchPattern":"try {\n  await deploy(schema);\n} catch (e) {\n  if (String(e.message).includes(\"Array type should have field `items`\")) {\n    throw new Error(\"Add an items schema, e.g. items: { type: \\\"string\\\" }\");\n  } else throw e;\n}","preventionTips":["Never declare a Windmill array type without items — element rules are mandatory.","Check generator output for missing `items` on untyped arrays.","Validate schemas in CI with a Windmill-aware linter."],"tags":["json-schema","array","validation","windmill"],"backgroundTag":"schema-validation-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}