Skip to content

Commit

Permalink
java paths/properties/setters/getters maintain '_'
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsessanchez committed Oct 20, 2023
1 parent 5decc87 commit b961009
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Fixed bug in java where underscores were removed from property names, setters and getters, but not paths in java. Underscores are now maintained throughout to preserve consistency with dotnet.
- Fixed missing imports for method parameters that are query parameters.
- Fixed query parameters type mapping for arrays. [#3354](https://github.com/microsoft/kiota/issues/3354)
- Fixed bug where base64url and decimal types would not be generated properly in Java.
Expand Down
6 changes: 3 additions & 3 deletions src/Kiota.Builder/Refiners/JavaRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance
CorrectNames(generatedCode, s =>
{
if (s.Contains('_', StringComparison.OrdinalIgnoreCase) &&
s.ToPascalCase(UnderscoreArray) is string refinedName &&
s.ToPascalCase() is string refinedName &&
!reservedNamesProvider.ReservedNames.Contains(s) &&
!reservedNamesProvider.ReservedNames.Contains(refinedName))
return refinedName;
Expand Down Expand Up @@ -75,14 +75,14 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance
CodePropertyKind.QueryParameter,
CodePropertyKind.RequestBuilder,
},
static s => s.ToCamelCase(UnderscoreArray).ToFirstCharacterLowerCase());
static s => s.ToCamelCase().ToFirstCharacterLowerCase());
AddGetterAndSetterMethods(generatedCode,
new() {
CodePropertyKind.Custom,
CodePropertyKind.AdditionalData,
CodePropertyKind.BackingStore,
},
static (_, s) => s.ToCamelCase(UnderscoreArray).ToFirstCharacterUpperCase(),
static (_, s) => s.ToCamelCase().ToFirstCharacterUpperCase(),
_configuration.UsesBackingStore,
true,
"get",
Expand Down

0 comments on commit b961009

Please sign in to comment.