Skip to content

Commit

Permalink
Fix deserialization of WorkflowRunUsage
Browse files Browse the repository at this point in the history
Fix `ToRubyCase()` not handling properties whose names are overridden to be entirely upper case.
  • Loading branch information
martincostello committed Oct 20, 2022
1 parent 8fff9d6 commit ce13860
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Octokit/Helpers/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ public static Uri ExpandUriTemplate(this string template, object values)
public static string ToRubyCase(this string propertyName)
{
Ensure.ArgumentNotNullOrEmptyString(propertyName, nameof(propertyName));

// If the entire property is already all upper case, then do not split it across
// word boundaries. For example, "UBUNTU" should not be changed to "u_b_u_n_t_u".
if (string.Equals(propertyName, propertyName.ToUpperInvariant(), StringComparison.Ordinal))
{
return propertyName;
}

return string.Join("_", propertyName.SplitUpperCase()).ToLowerInvariant();
}

Expand Down

0 comments on commit ce13860

Please sign in to comment.