{"record":{"id":"b91854e1b2d5c610","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-ordinal-date-must-b","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.ordinal.date' must be a mapping, not a scalar or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.ordinal\\.date' must be a mapping, not a scalar or sequence\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs","lineNumber":427,"sourceCode":"                    $\"Locale '{localeCode}.surfaces.ordinal' defines unsupported property '{property}'. Supported properties: numeric, date, dateOnly.\");\n            }\n\n            if (ordinalSurface.TryGetValue(\"numeric\", out var numericValue))\n            {\n                if (numericValue is not SimpleYamlMapping numericMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.numeric' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"ordinalizer\"] = numericMapping;\n            }\n\n            if (ordinalSurface.TryGetValue(\"date\", out var dateValue))\n            {\n                if (dateValue is not SimpleYamlMapping dateMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.date' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"dateToOrdinalWords\"] = dateMapping;\n            }\n\n            if (ordinalSurface.TryGetValue(\"dateOnly\", out var dateOnlyValue))\n            {\n                if (dateOnlyValue is not SimpleYamlMapping dateOnlyMapping)\n                {\n                    throw new InvalidOperationException(\n                        $\"Locale '{localeCode}.surfaces.ordinal.dateOnly' must be a mapping, not a scalar or sequence.\");\n                }\n\n                features[\"dateOnlyToOrdinalWords\"] = dateOnlyMapping;\n            }\n        }\n","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L409-L445","documentation":"Thrown by AddOrdinalFeatures when surfaces.ordinal.date is present but is not a YAML mapping. The 'date' surface (dateToOrdinalWords) must be a mapping, so scalar/sequence values fail the build.","triggerScenarios":"A locale YAML declares 'date: true' or 'date: [first, second]' under surfaces.ordinal. The type guard at CanonicalLocaleAuthoring.cs:425-429 fails because dateValue is not a SimpleYamlMapping.","commonSituations":"Treating 'date' as an enable flag; pasting a list of day ordinals; mis-indenting the block.","solutions":["Rewrite surfaces.ordinal.date as a mapping matching the dateToOrdinalWords rule shape.","Copy the structure from a reference locale (e.g. en.yml) and translate values.","Rebuild to confirm AddOrdinalFeatures accepts the surface."],"exampleFix":"# before\nordinal:\n  date: on\n# after\nordinal:\n  date:\n    1: first","handlingStrategy":"validation","validationCode":"# Ensure surfaces.ordinal.date is a mapping, not a scalar/sequence.\n# YAML lint: 'date:' must be followed by an indented mapping block.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 'date' as a rule mapping (dateToOrdinalWords), not an enable flag.","Mirror the structure from a reference locale.","Build after edits to confirm AddOrdinalFeatures accepts it."],"tags":["localization","yaml","source-generator","locale","build","ordinal"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}