File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
src/JsonApiDotNetCore.OpenApi.Client.NSwag
test/OpenApiTests/NamingConventions/KebabCase Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 3
3
using SysNotNull = System . Diagnostics . CodeAnalysis . NotNullAttribute ;
4
4
5
5
#pragma warning disable AV1008 // Class should not be static
6
+ #pragma warning disable format
6
7
7
8
namespace JsonApiDotNetCore . OpenApi . Client . NSwag ;
8
9
9
10
internal static class ArgumentGuard
10
11
{
11
12
[ AssertionMethod ]
12
- public static void NotNull < T > ( [ NoEnumeration ] [ SysNotNull ] T ? value , [ CallerArgumentExpression ( " value" ) ] string ? parameterName = null )
13
+ public static void NotNull < T > ( [ NoEnumeration ] [ SysNotNull ] T ? value , [ CallerArgumentExpression ( nameof ( value ) ) ] string ? parameterName = null )
13
14
where T : class
14
15
{
15
16
ArgumentNullException . ThrowIfNull ( value , parameterName ) ;
Original file line number Diff line number Diff line change @@ -36,9 +36,9 @@ public override string ConvertName(string name)
36
36
37
37
if ( position + 1 != spanName . Length )
38
38
{
39
- isNextLower = spanName [ position + 1 ] > 96 && spanName [ position + 1 ] < 123 ;
40
- isNextUpper = spanName [ position + 1 ] > 64 && spanName [ position + 1 ] < 91 ;
41
- isNextSpace = spanName [ position + 1 ] == 32 ;
39
+ isNextLower = spanName [ position + 1 ] is >= 'a' and <= 'z' ;
40
+ isNextUpper = spanName [ position + 1 ] is >= 'A' and <= 'Z' ;
41
+ isNextSpace = spanName [ position + 1 ] == ' ' ;
42
42
}
43
43
44
44
if ( isCurrentSpace && ( isPreviousSpace || isPreviousSeparator || isNextUpper || isNextSpace ) )
@@ -47,9 +47,9 @@ public override string ConvertName(string name)
47
47
}
48
48
else
49
49
{
50
- bool isCurrentUpper = spanName [ position ] > 64 && spanName [ position ] < 91 ;
51
- bool isPreviousLower = spanName [ position - 1 ] > 96 && spanName [ position - 1 ] < 123 ;
52
- bool isPreviousNumber = spanName [ position - 1 ] > 47 && spanName [ position - 1 ] < 58 ;
50
+ bool isCurrentUpper = spanName [ position ] is >= 'A' and <= 'Z' ;
51
+ bool isPreviousLower = spanName [ position - 1 ] is >= 'a' and <= 'z' ;
52
+ bool isPreviousNumber = spanName [ position - 1 ] is >= '0' and <= '9' ;
53
53
54
54
if ( isCurrentUpper && ( isPreviousLower || isPreviousNumber || isNextLower || isNextSpace ) )
55
55
{
@@ -76,6 +76,6 @@ public override string ConvertName(string name)
76
76
}
77
77
}
78
78
79
- return stringBuilder . ToString ( ) . ToLower ( ) ;
79
+ return stringBuilder . ToString ( ) . ToLowerInvariant ( ) ;
80
80
}
81
81
}
You can’t perform that action at this time.
0 commit comments