{"record":{"id":"97a0f3aac428c20b","repo":"Humanizr/Humanizer","slug":"property-propertyname-must-be-an-integer","errorCode":null,"errorMessage":"Property '{propertyName}' must be an integer.","messagePattern":"Property '(.+?)' must be an integer\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/GenerationHelpers.cs","lineNumber":232,"sourceCode":"            ?? GetOptionalString(formatter.ProfileRoot, \"pluralRule\")\n            ?? GetOptionalString(formatter.ProfileRoot, \"resourceKeyDetector\");\n    }\n\n    static bool GetBoolean(JsonElement element, string propertyName) =>\n        element.TryGetProperty(propertyName, out var valueElement) &&\n        valueElement.ValueKind == JsonValueKind.True;\n\n    static JsonElement GetRequiredProperty(JsonElement element, string propertyName) =>\n        element.TryGetProperty(propertyName, out var property)\n            ? property\n            : throw new InvalidOperationException($\"Missing required property '{propertyName}'.\");\n\n    static long GetRequiredInt64(JsonElement element, string propertyName)\n    {\n        var property = GetRequiredProperty(element, propertyName);\n        return property.ValueKind == JsonValueKind.Number && property.TryGetInt64(out var value)\n            ? value\n            : throw new InvalidOperationException($\"Property '{propertyName}' must be an integer.\");\n    }\n\n    static long? GetOptionalInt64(JsonElement element, string propertyName)\n    {\n        return !element.TryGetProperty(propertyName, out var property) || property.ValueKind != JsonValueKind.Number\n            ? null\n            : property.TryGetInt64(out var value) ? value : null;\n    }\n\n    /// <summary>\n    /// Emits a generated <c>string[]</c> from either a plain YAML sequence or a sparse\n    /// numeric-slot mapping.\n    ///\n    /// Supported source shapes:\n    ///\n    /// 1. Plain array:\n    ///    <code>\n    ///    unitsMap:","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/GenerationHelpers.cs#L214-L250","documentation":"GenerationHelpers.GetRequiredInt64 (GenerationHelpers.cs:227-233) first ensures the property exists (else error 110) then requires its JSON value to be a Number that fits int64. A float, a quoted string, a boolean, or an out-of-range number fails ValueKind/TryGetInt64 and throws.","triggerScenarios":"A required integer property holds a JSON float (1.5), a string (\"5\"), true/false, or a number too large for int64.","commonSituations":"YAML number parsed as a float due to a decimal point; value quoted as a string; locale data authored with a numeric-looking string.","solutions":["Make the value an integer literal with no decimal point.","If it is a quoted string, remove the quotes so it parses as a JSON number.","Confirm the value is within int64 range."],"exampleFix":"// before\n{ \"base\": \"10\" }\n// after\n{ \"base\": 10 }","handlingStrategy":"validation","validationCode":"// Required integer must be a JSON number fitting int64 (C#)\nif (!el.TryGetProperty(name, out var p) || p.ValueKind != JsonValueKind.Number || !p.TryGetInt64(out _))\n    throw new InvalidOperationException($\"Property '{name}' must be an integer\");","typeGuard":"static bool IsInt64(JsonElement el, string name) =>\n    el.TryGetProperty(name, out var p) && p.ValueKind == JsonValueKind.Number && p.TryGetInt64(out _);","tryCatchPattern":null,"preventionTips":["Write integer values without decimal points so YAML/JSON keep them numeric.","Do not quote integers as strings.","Validate numeric ranges where int64 is assumed."],"tags":["source-generator","build-time","engine-contract","json","type-mismatch","locale-data"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}