diff --git a/src/Kiota.Builder/Refiners/PythonRefiner.cs b/src/Kiota.Builder/Refiners/PythonRefiner.cs index 1cb92885d9..639e3403da 100644 --- a/src/Kiota.Builder/Refiners/PythonRefiner.cs +++ b/src/Kiota.Builder/Refiners/PythonRefiner.cs @@ -182,6 +182,18 @@ private static void CorrectCommonNames(CodeElement currentElement) { param.Name = param.Name.ToFirstCharacterLowerCase().ToSnakeCase(); } + if (parentClassM.IsOfKind(CodeClassKind.Model)) + { + foreach (var prop in parentClassM.Properties) + { + if (string.IsNullOrEmpty(prop.SerializationName)) + { + prop.SerializationName = prop.Name; + } + + parentClassM.RenameChildElement(prop.Name, prop.Name.ToFirstCharacterLowerCase().ToSnakeCase()); + } + } } else if (currentElement is CodeClass c) { @@ -191,7 +203,6 @@ private static void CorrectCommonNames(CodeElement currentElement) (p.IsOfKind(CodePropertyKind.RequestAdapter) || p.IsOfKind(CodePropertyKind.PathParameters) || p.IsOfKind(CodePropertyKind.QueryParameters) || - p.IsOfKind(CodePropertyKind.Custom) || p.IsOfKind(CodePropertyKind.UrlTemplate)) && currentElement.Parent is CodeClass parentClassP) { diff --git a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs index 564d38b72e..ce50b0d849 100644 --- a/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs +++ b/tests/Kiota.Builder.Tests/Refiners/PythonLanguageRefinerTests.cs @@ -278,7 +278,7 @@ public async Task CorrectsCoreType() var model = root.AddClass(new CodeClass { Name = "model", - Kind = CodeClassKind.Model + Kind = CodeClassKind.RequestBuilder }).First(); model.AddProperty(new CodeProperty {