diff --git a/src/NJsonSchema.CodeGeneration.CSharp/CSharpPropertyNameGenerator.cs b/src/NJsonSchema.CodeGeneration.CSharp/CSharpPropertyNameGenerator.cs index 2c61c752f..2a42c6df8 100644 --- a/src/NJsonSchema.CodeGeneration.CSharp/CSharpPropertyNameGenerator.cs +++ b/src/NJsonSchema.CodeGeneration.CSharp/CSharpPropertyNameGenerator.cs @@ -11,7 +11,7 @@ namespace NJsonSchema.CodeGeneration.CSharp /// Generates the property name for a given CSharp . public sealed class CSharpPropertyNameGenerator : IPropertyNameGenerator { - private static readonly char[] _reservedFirstPassChars = { '"', '\'', '@', '?', '!', '$', '[', ']', '(', ')', '.', '=', '+' }; + private static readonly char[] _reservedFirstPassChars = { '"', '\'', '@', '?', '!', '$', '[', ']', '(', ')', '.', '=', '+', '|' }; private static readonly char[] _reservedSecondPassChars = { '*', ':', '-', '#', '&' }; /// Generates the property name. @@ -35,7 +35,8 @@ public string Generate(JsonSchemaProperty property) .Replace(")", string.Empty) .Replace(".", "-") .Replace("=", "-") - .Replace("+", "plus"); + .Replace("+", "plus") + .Replace("|", "_"); } name = ConversionUtilities.ConvertToUpperCamelCase(name, true); @@ -53,4 +54,4 @@ public string Generate(JsonSchemaProperty property) return name; } } -} \ No newline at end of file +}