Skip to content

Commit 5530832

Browse files
committed
Replace ToPascalCase extension method with Humanizer call
1 parent 7329594 commit 5530832

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

src/JsonApiDotNetCore.OpenApi.Swashbuckle/JsonApiSchemaIdSelector.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,20 @@ private string ApplySchemaTemplate(string schemaTemplate, ResourceType? resource
118118

119119
if (resourceType != null)
120120
{
121-
schemaId = schemaId.Replace("[ResourceName]", resourceType.PublicName.Singularize()).ToPascalCase();
121+
schemaId = schemaId.Replace("[ResourceName]", resourceType.PublicName.Singularize()).Pascalize();
122122
}
123123

124124
if (relationshipName != null)
125125
{
126-
schemaId = schemaId.Replace("[RelationshipName]", relationshipName.ToPascalCase());
126+
schemaId = schemaId.Replace("[RelationshipName]", relationshipName.Pascalize());
127127
}
128128

129129
if (operationCode != null)
130130
{
131-
schemaId = schemaId.Replace("[OperationCode]", operationCode.Value.ToString().ToPascalCase());
131+
schemaId = schemaId.Replace("[OperationCode]", operationCode.Value.ToString().Pascalize());
132132
}
133133

134-
string pascalCaseSchemaId = schemaId.ToPascalCase();
134+
string pascalCaseSchemaId = schemaId.Pascalize();
135135

136136
JsonNamingPolicy? namingPolicy = _options.SerializerOptions.PropertyNamingPolicy;
137137
return namingPolicy != null ? namingPolicy.ConvertName(pascalCaseSchemaId) : pascalCaseSchemaId;

src/JsonApiDotNetCore.OpenApi.Swashbuckle/OpenApiOperationIdSelector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private string ApplyTemplate(string openApiOperationIdTemplate, ResourceType? re
109109
.Replace("[Method]", method)
110110
.Replace("[PrimaryResourceName]", resourceType?.PublicName.Singularize())
111111
.Replace("[RelationshipName]", relationshipName)
112-
.ToPascalCase();
112+
.Pascalize();
113113

114114
// @formatter:wrap_before_first_method_call true restore
115115
// @formatter:wrap_chained_method_calls restore

src/JsonApiDotNetCore.OpenApi.Swashbuckle/StringExtensions.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)