{"record":{"id":"d9d86b03f6ddb7ae","repo":"Humanizr/Humanizer","slug":"locale-localecode-surfaces-ordinal-dateonly-mu","errorCode":null,"errorMessage":"Locale '{localeCode}.surfaces.ordinal.dateOnly' must be a mapping, not a scalar or sequence.","messagePattern":"Locale '(.+?)\\.surfaces\\.ordinal\\.dateOnly' 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":438,"sourceCode":"                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\n        static void AddCalendarFeatures(\n            string localeCode,\n            SimpleYamlMapping calendarSurface,\n            ImmutableDictionary<string, SimpleYamlValue>.Builder features)\n        {\n            foreach (var property in calendarSurface.Values.Keys.Where(static property => property is not (\"months\" or \"monthsGenitive\" or \"hijriMonths\")))\n            {\n                throw new InvalidOperationException(\n                    $\"Locale '{localeCode}.surfaces.calendar' defines unsupported property '{property}'. Supported properties: months, monthsGenitive, hijriMonths.\");\n            }\n","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/CanonicalLocaleAuthoring.cs#L420-L456","documentation":"Thrown by AddOrdinalFeatures when surfaces.ordinal.dateOnly is present but is not a YAML mapping. The 'dateOnly' surface (dateOnlyToOrdinalWords) must be a mapping; scalar or sequence values are rejected at build time.","triggerScenarios":"A locale YAML writes 'dateOnly: true' or a list under surfaces.ordinal.dateOnly. The type guard at CanonicalLocaleAuthoring.cs:436-440 fails because dateOnlyValue is not a SimpleYamlMapping.","commonSituations":"Confusing dateOnly with a boolean enable flag; pasting an array; mis-indentation turning the mapping into a scalar.","solutions":["Rewrite surfaces.ordinal.dateOnly as a mapping matching the dateOnlyToOrdinalWords rule shape.","Mirror the structure of surfaces.ordinal.date from a reference locale and adjust for date-only semantics.","Rebuild to confirm the ordinal surface validates."],"exampleFix":"# before\nordinal:\n  dateOnly: true\n# after\nordinal:\n  dateOnly:\n    1: first","handlingStrategy":"validation","validationCode":"# Ensure surfaces.ordinal.dateOnly is a mapping, not a scalar/sequence.\n# YAML lint: 'dateOnly:' must be followed by an indented mapping block.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 'dateOnly' as a rule mapping (dateOnlyToOrdinalWords), not a boolean.","Mirror surfaces.ordinal.date from a reference locale and adjust for date-only semantics.","Build after edits to confirm the type guard passes."],"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"}