Skip to content

Commit

Permalink
Fix bug from generation of model names (#4817)
Browse files Browse the repository at this point in the history
* Fixes Go snippet generation

* Format code

* Fixes Go snippet generation

* Format code

* Fix build

* fix missing version
  • Loading branch information
rkodev authored Jul 2, 2024
1 parent 62c18f1 commit 450e1eb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Fixes bug with model names in Go generated from camel case namespace. [https://github.com/microsoftgraph/msgraph-sdk-go/issues/721]
- Plugins OpenAPI extensions are only added when generating plugins to reduce the risk of parsing errors. [#4834](https://github.com/microsoft/kiota/issues/4834)
- TypeScript imports are now using ES6 imports with the .js extension.
- Remove LINQ usage in generated code.
- Ensures descriptions are not empty in sliced OpenApi file when generating a plugin.
- Plugins do not emit parameters anymore. [#4841](https://github.com/microsoft/kiota/issues/4841)
- References to C# types generated by kiota are prefixed with `global::` to avoid name collisions. [#4796](https://github.com/microsoft/kiota/issues/4796)


## [1.15.0] - 2024-06-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Refiners/GoRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance
{
cancellationToken.ThrowIfCancellationRequested();
DeduplicateErrorMappings(generatedCode);
NormalizeNamespaceNames(generatedCode);
MoveRequestBuilderPropertiesToBaseType(generatedCode,
new CodeUsing
{
Expand All @@ -40,6 +39,7 @@ public override Task Refine(CodeNamespace generatedCode, CancellationToken cance
FlattenNestedHierarchy(generatedCode);
FlattenGoParamsFileNames(generatedCode);
FlattenGoFileNames(generatedCode);
NormalizeNamespaceNames(generatedCode);
AddInnerClasses(
generatedCode,
true,
Expand Down
3 changes: 3 additions & 0 deletions tests/Kiota.Builder.Tests/Refiners/GoLanguageRefinerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,12 @@ public async Task NormalizeNamespaceName()
root.Name = "github.com/OrgName/RepoName";
var models = root.AddNamespace("ApiSdk.models");
var submodels = models.AddNamespace("ApiSdk.models.submodels");
var camelCaseModel = submodels.AddNamespace("ApiSdk.models.submodels.camelCase");
await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Go, ClientNamespaceName = "github.com/OrgName/RepoName" }, root);
Assert.Equal("github.com/OrgName/RepoName.apisdk.models.submodels", submodels.Name);
Assert.Equal("github.com/OrgName/RepoName.apisdk.models", models.Name);
Assert.Equal("github.com/OrgName/RepoName.apisdk.models.submodels.camelcase", camelCaseModel.Name);
}

#endregion
}

0 comments on commit 450e1eb

Please sign in to comment.