{"record":{"id":"85488b4e5ee4f708","repo":"windmill-labs/windmill","slug":"oneof-variant-definition-title-field-should-be-a","errorCode":null,"errorMessage":"oneOf variant definition `title` field should be a string","messagePattern":"oneOf variant definition `title` field should be a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-common/src/schema.rs","lineNumber":97,"sourceCode":"                    for (key, v) in properties {\n                        obj_rules.push((key.clone(), SchemaValidationRule::from_value(v)?))\n                    }\n\n                    schema_rules.push(SchemaValidationRule::IsObject(obj_rules));\n                } else if let Some(one_of) = val.get(\"oneOf\") {\n                    let one_of = one_of\n                        .as_array()\n                        .ok_or(anyhow!(\"`oneOf` needs to be an array\"))?;\n                    let mut rules_map: HashMap<String, Vec<SchemaValidationRule>> = HashMap::new();\n\n                    for variant in one_of {\n                        let variant_label = variant\n                            .get(\"title\")\n                            .ok_or(anyhow!(\n                                \"oneOf variant definition should have a `title` field\"\n                            ))?\n                            .as_str()\n                            .ok_or(anyhow!(\n                                \"oneOf variant definition `title` field should be a string\"\n                            ))?;\n                        if !rules_map.contains_key(variant_label) {\n                            rules_map.insert(\n                                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\")","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-common/src/schema.rs#L79-L115","documentation":"Raised by SchemaValidationRule::from_value in windmill-common while compiling a JSON Schema into internal validation rules: each oneOf variant must carry a string `title` — Windmill uses it to label and select variants at runtime — and one variant's title was absent or not a string. The malformed schema is rejected at parse time rather than producing ambiguous runtime matching.","triggerScenarios":"A `oneOf` variant with a non-string `title`, e.g. `\"title\": 1` or `\"title\": {\"en\": \"A\"}`.","commonSituations":"Programmatic schema generation producing numeric titles, YAML/JSON type coercion (e.g. unquoted title that parses as a number), localization objects used instead of plain strings.","solutions":["Change `title` to a plain string value.","Quote YAML titles that would otherwise parse as numbers/booleans.","Validate the schema before deployment to catch malformed titles."],"exampleFix":"// before\n{ \"title\": 1, \"type\": \"object\" }\n// after\n{ \"title\": \"Option 1\", \"type\": \"object\" }","handlingStrategy":"validation","validationCode":"const s = JSON.parse(schemaRaw);\nconst bad = (s.oneOf ?? []).filter(v => \"title\" in v && typeof v.title !== \"string\");\nif (bad.length) throw new Error(\"oneOf `title` values must be strings\");","typeGuard":"function titlesAreStrings(s) {\n  return !Array.isArray(s.oneOf) || s.oneOf.every(v => !(\"title\" in v) || typeof v.title === \"string\");\n}","tryCatchPattern":"try {\n  await deploy(schema);\n} catch (e) {\n  if (String(e.message).includes(\"`title` field should be a string\")) {\n    throw new Error(\"Convert oneOf variant titles to plain strings\");\n  } else throw e;\n}","preventionTips":["Quote YAML titles that could coerce to numbers or booleans.","Never use numeric or object titles for variants.","Run a schema lint step before deployment."],"tags":["json-schema","oneof","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"}