{"record":{"id":"6453b46f0a176e5a","repo":"windmill-labs/windmill","slug":"object-type-should-have-a-properties-or-anyof","errorCode":null,"errorMessage":"Object type should have a `properties` or `anyOf` field, or be a resource","messagePattern":"Object type should have a `properties` or `anyOf` field, or be a resource","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-common/src/schema.rs","lineNumber":120,"sourceCode":"                                variant_label.to_string(),\n                                SchemaValidationRule::from_value(variant)?,\n                            );\n                        } else {\n                            return Err(anyhow!(\n                                \"oneOf definition has a duplicate variant `{variant_label}`\"\n                            ));\n                        }\n                    }\n\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 => {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-common/src/schema.rs#L102-L138","documentation":"An object-typed schema in Windmill must be one of: having `properties`, having `anyOf`, or being a resource (its `format` starts with `resource-`). A bare `{ \"type\": \"object\" }` with none of these gives the parser no rules to build, so it is rejected.","triggerScenarios":"Declaring `\"type\": \"object\"` in a script/flow input schema without `properties`, without `anyOf`, and without `\"format\": \"resource-...\"`.","commonSituations":"Accepting arbitrary free-form JSON input; schemas copied from generic JSON Schema docs; removing properties and leaving an empty object node; wanting a dict but not knowing Windmill requires a resource format or properties.","solutions":["If arbitrary key/value input is needed, use `\"format\": \"resource-windmill-u-py\"`-style resource typing or define the fields under `properties`.","Add a `properties` object describing the expected fields (even one).","Use `anyOf` with concrete object variants.","Change the primitive to `string` if the value is actually unstructured."],"exampleFix":"// before\n{ \"type\": \"object\" }\n// after\n{ \"type\": \"object\", \"properties\": { \"name\": { \"type\": \"string\" } } }","handlingStrategy":"validation","validationCode":"const s = JSON.parse(schemaRaw);\nconst isResource = typeof s.format === \"string\" && s.format.startsWith(\"resource\");\nif (s.type === \"object\" && !s.properties && !s.anyOf && !isResource) {\n  throw new Error(\"Object schema needs `properties`, `anyOf`, or a resource-* format\");\n}","typeGuard":"function isWellFormedObjectSchema(s) {\n  const isResource = typeof s?.format === \"string\" && s.format.startsWith(\"resource\");\n  return s?.type !== \"object\" || Boolean(s.properties || s.anyOf || isResource);\n}","tryCatchPattern":"try {\n  await deploy(schema);\n} catch (e) {\n  if (String(e.message).includes(\"should have a `properties` or `anyOf` field\")) {\n    throw new Error(\"Declare object fields under properties, use anyOf, or set a resource-* format\");\n  } else throw e;\n}","preventionTips":["In Windmill, a bare `type: object` is never valid — always add properties/anyOf or a resource format.","For free-form dicts, check current Windmill docs for the accepted pattern instead of assuming plain JSON Schema.","Lint every input/output schema before deploying."],"tags":["json-schema","object","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"}