Skip to content

Commit 5bb3e40

Browse files
committed
- fixes a bug where navigation properties of collections would not be serialized
1 parent 835c741 commit 5bb3e40

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/GraphODataTemplateWriter/CodeHelpers/Java/TypeHelperJava.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ public static string CreatePackageDefForEnum(this CustomT4Host host)
754754
}
755755
public static string GetPackagePrefix(this OdcmObject obj)
756756
{
757-
switch(obj)
757+
switch (obj)
758758
{
759759
case OdcmEnum e:
760760
return "models.generated";
@@ -860,7 +860,7 @@ public static string CreatePackageDefForBaseMethodRequestBuilder(this CustomT4Ho
860860
sb.Append("\n");
861861

862862
var imports = host.CurrentType.AsOdcmMethod().WithOverloads().SelectMany(x => ImportClassesOfMethodParameters(x));
863-
sb.Append(imports.Any() ? imports.Aggregate((x, y) => $"{x}{Environment.NewLine}{y}"): string.Empty);
863+
sb.Append(imports.Any() ? imports.Aggregate((x, y) => $"{x}{Environment.NewLine}{y}") : string.Empty);
864864
return sb.ToString();
865865
}
866866

@@ -1463,14 +1463,15 @@ public static string CreatePropertyDef(IEnumerable<OdcmProperty> properties, boo
14631463
var propertyFormat = format;
14641464
if (property.IsCollection)
14651465
{
1466-
if (!property.IsNavigation())
1466+
if (property.IsNavigation())
14671467
{
1468-
propertyType = "java.util.List<" + property.GetTypeString() + ">";
1468+
propertyType = TypeCollectionPage(property);
1469+
if (!property.ContainsTarget)
1470+
propertyFormat = collectionFormat;
14691471
}
14701472
else
14711473
{
1472-
propertyType = TypeCollectionPage(property);
1473-
propertyFormat = collectionFormat;
1474+
propertyType = "java.util.List<" + property.GetTypeString() + ">";
14741475
}
14751476
}
14761477
else

0 commit comments

Comments
 (0)