Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaTP committed Apr 2, 2024
1 parent 7ae4a32 commit 724b63f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion it/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@
]
},
"./tests/Kiota.Builder.IntegrationTests/DiscriminatorSample.yaml": {
"MockServerITFolder": "discriminator"
"MockServerITFolder": "discriminator",
"Suppressions": [
{
"Language": "ruby",
"Rationale": "https://github.com/microsoft/kiota/issues/2484"
}
]
},
"./tests/Kiota.Builder.IntegrationTests/InheritingErrors.yaml": {
"MockServerITFolder": "basic",
Expand Down
6 changes: 4 additions & 2 deletions src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ private void WriteFactoryMethodBodyForInheritedModel(CodeClass parentClass, Lang
private void WriteFactoryMethodBodyForUnionModel(CodeMethod codeElement, CodeClass parentClass, CodeParameter parseNodeParameter, LanguageWriter writer)
{
var className = parentClass.Name;
if (parentClass.Parent != null && !string.IsNullOrEmpty(parentClass.Parent.Name))
if (parentClass.Parent is CodeClass pc &&
!string.IsNullOrEmpty(pc.Name) &&
pc.InnerClasses.Any(x => x == parentClass))
{
className = $"{parentClass.Parent!.Name}.{parentClass.Name}";
className = $"{pc.Name}.{parentClass.Name}";
}
writer.WriteLine($"{ResultVarName} = {className}()");
var includeElse = false;
Expand Down

0 comments on commit 724b63f

Please sign in to comment.