Skip to content

Commit c6990c5

Browse files
author
Brian Melton
committed
Fixing bug related to Edm namespace prefixing whereby types like
Edm.Boolean were being converted to microsoft.graph.extensions.Boolean instead of java.lang.Boolean
1 parent 4173311 commit c6990c5

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

Templates/Android/BaseModel.template.tt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
CustomT4Host host = (CustomT4Host) Host;
66
var model = host.CurrentModel;
77
CodeWriterAndroid writer = (CodeWriterAndroid) host.CodeWriter;
8-
bool logTemplateSrc = false;
8+
bool logTemplateSrc = true;
99
var c = host.CurrentType;
1010
#>
1111
<# if (logTemplateSrc) { #>
@@ -619,14 +619,14 @@ public {1} {2}{3}{4} {{";
619619
* The {0}.
620620
*/
621621
@SerializedName(""{1}"")
622-
public {4}{2} {3};
622+
public {2} {3};
623623

624624
";
625625
var collectionFormat =
626626
@" /**
627627
* The {0}.
628628
*/
629-
public transient {4}{2} {3};
629+
public transient {2} {3};
630630

631631
";
632632

@@ -635,7 +635,6 @@ public {1} {2}{3}{4} {{";
635635
var propertyName = property.Name.ToUpperFirstChar();
636636
var propertyType = "";
637637
var propertyFormat = format;
638-
var shouldFullyQualify = TypeHelperAndroid.ReservedNames.Contains(propertyName);
639638
if (property.IsCollection)
640639
{
641640
if (!property.IsNavigation())
@@ -657,8 +656,7 @@ public {1} {2}{3}{4} {{";
657656
propertyName.SplitCamelCase(),
658657
property.Name,
659658
propertyType,
660-
property.SanitizePropertyName().ToLowerFirstChar(),
661-
shouldFullyQualify ? "com.microsoft.graph.extensions." : "");
659+
property.SanitizePropertyName().ToLowerFirstChar());
662660
}
663661
return sb.ToString();
664662
}

src/GraphODataTemplateWriter/CodeHelpers/Android/TypeHelperAndroid.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public static string GetTypeString(this OdcmType @type)
3535
return "java.util.Calendar";
3636
case "Date":
3737
return "com.microsoft.graph.model.DateOnly";
38+
case "Json":
39+
return "com.google.gson.JsonElement";
3840
case "Binary":
3941
return "byte[]";
4042
default:
@@ -49,7 +51,13 @@ public static string GetTypeString(this OdcmParameter parameter)
4951

5052
public static string GetTypeString(this OdcmProperty property)
5153
{
52-
return GetTypeString(property.Projection.Type);
54+
var propertyType = property.Projection.Type;
55+
var typeString = GetTypeString(propertyType);
56+
if (propertyType.Namespace != OdcmNamespace.Edm && ReservedNames.Contains(typeString))
57+
{
58+
typeString = "com.microsoft.graph.extensions." + typeString;
59+
}
60+
return typeString;
5361
}
5462

5563
public static bool IsComplex(this OdcmParameter property)

0 commit comments

Comments
 (0)