Skip to content

Commit 0af305a

Browse files
author
Caitlin Bales
committed
Replace invalid characters
1 parent 94a54e1 commit 0af305a

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

Templates/CSharp/Model/ComplexType.cs.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace <#=complex.Namespace.GetNamespaceName()#>
6161
/// Gets or sets <#=property.Name#>.
6262
<# if (property.LongDescription != null) {
6363
#>
64-
/// <#=property.LongDescription#>
64+
/// <#=property.GetSanitizedLongDescription()#>
6565
<# } #>
6666
/// </summary>
6767
<#=attributeDefinition#>
@@ -76,7 +76,7 @@ namespace <#=complex.Namespace.GetNamespaceName()#>
7676
/// Gets or sets <#=property.Name#>.
7777
<# if (property.LongDescription != null) {
7878
#>
79-
/// <#=property.LongDescription#>
79+
/// <#=property.GetSanitizedLongDescription()#>
8080
<# } #>
8181
/// </summary>
8282
<#=attributeDefinition#>

Templates/CSharp/Model/EntityType.cs.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace <#=entity.Namespace.GetNamespaceName()#>
8888
/// Gets or sets <#=property.Name.SplitCamelCase().ToLower()#>.
8989
<# if (property.LongDescription != null) {
9090
#>
91-
/// <#=property.LongDescription#>
91+
/// <#=property.GetSanitizedLongDescription()#>
9292
<# } #>
9393
/// </summary>
9494
<#=attributeDefinition#>
@@ -103,7 +103,7 @@ namespace <#=entity.Namespace.GetNamespaceName()#>
103103
/// Gets or sets <#=property.Name.SplitCamelCase().ToLower()#>.
104104
<# if (property.LongDescription != null) {
105105
#>
106-
/// <#=property.LongDescription#>
106+
/// <#=property.GetSanitizedLongDescription()#>
107107
<# } #>
108108
/// </summary>
109109
<#=attributeDefinition#>
@@ -119,7 +119,7 @@ namespace <#=entity.Namespace.GetNamespaceName()#>
119119
/// Gets or sets <#=property.Name.SplitCamelCase().ToLower()#>.
120120
<# if (property.LongDescription != null) {
121121
#>
122-
/// <#=property.LongDescription#>
122+
/// <#=property.GetSanitizedLongDescription()#>
123123
<# } #>
124124
/// </summary>
125125
<#=attributeDefinition#>

src/GraphODataTemplateWriter/CodeHelpers/CSharp/TypeHelperCSharp.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ public static string GetToLowerFirstCharName(this OdcmProperty property)
211211
return property.Name.ToLowerFirstChar();
212212
}
213213

214+
public static string GetSanitizedLongDescription(this OdcmProperty property)
215+
{
216+
if (property.LongDescription != null)
217+
{
218+
return property.LongDescription.Replace("<", "&lt;").Replace(">", "&gt;").Replace("&", "&amp;");
219+
}
220+
return null;
221+
}
222+
214223
public static string GetSanitizedPropertyName(this OdcmProperty property)
215224
{
216225
return GetSanitizedPropertyName(property.Name);

0 commit comments

Comments
 (0)