Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp.Generation
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Text.RegularExpressions;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.CSharp.Tests/AllOfTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NJsonSchema.CodeGeneration.CSharp;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.CSharp.Tests/ArrayTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using NJsonSchema.Annotations;
using NJsonSchema.NewtonsoftJson.Generation;
using System.ComponentModel.DataAnnotations;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
public class CSharpJsonSerializerGeneratorTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
public class DefaultPropertyTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using NJsonSchema.NewtonsoftJson.Generation;
using System.ComponentModel.DataAnnotations;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.CSharp.Tests/EnumTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Newtonsoft.Json.Converters;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Newtonsoft.Json.Converters;
using NJsonSchema.Annotations;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Converters;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NJsonSchema.CodeGeneration.CSharp;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using System.ComponentModel.DataAnnotations;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.CSharp.Tests/NumberTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NJsonSchema.CodeGeneration.CSharp;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.Infrastructure;
using System.Reflection;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.CSharp
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.CSharp.Tests/UriTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Newtonsoft.Json;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.CSharp.Tests
{
Expand Down
1 change: 1 addition & 0 deletions src/NJsonSchema.CodeGeneration.CSharp/CSharpGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using NJsonSchema.CodeGeneration.CSharp.Models;

namespace NJsonSchema.CodeGeneration.CSharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;

namespace NJsonSchema.CodeGeneration.CSharp
{
/// <summary>Generates JSON converter code.</summary>
Expand Down
2 changes: 2 additions & 0 deletions src/NJsonSchema.CodeGeneration.CSharp/CSharpTypeResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;

namespace NJsonSchema.CodeGeneration.CSharp
{
/// <summary>Manages the generated types and converts JSON types to CSharp types. </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using NJsonSchema.CodeGeneration.Models;

namespace NJsonSchema.CodeGeneration.CSharp.Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;

namespace NJsonSchema.CodeGeneration.CSharp.Models
{
/// <summary>The DateFormatConverterTemplateModel.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//-----------------------------------------------------------------------

using System.Globalization;
using System.Linq;
using NJsonSchema.CodeGeneration.Models;

namespace NJsonSchema.CodeGeneration.CSharp.Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
<None Include="NuGetIcon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<Using Remove="System.Linq" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.CodeGeneration.TypeScript;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.CodeGeneration.TypeScript;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Newtonsoft.Json.Serialization;
using NJsonSchema.CodeGeneration.CSharp;
using NJsonSchema.CodeGeneration.TypeScript;
using Xunit;
using System.Reflection;
using System.CodeDom.Compiler;
using NJsonSchema.NewtonsoftJson.Converters;
Expand Down
1 change: 0 additions & 1 deletion src/NJsonSchema.CodeGeneration.Tests/LiquidTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Globalization;
using Fluid;
using NJsonSchema.CodeGeneration.TypeScript;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Newtonsoft.Json.Linq;
using NJsonSchema.CodeGeneration.TypeScript;
using NJsonSchema.NewtonsoftJson.Generation;
using Xunit;

namespace NJsonSchema.CodeGeneration.Tests.Samples
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using NJsonSchema.CodeGeneration.Models;

namespace NJsonSchema.CodeGeneration.TypeScript.Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using NJsonSchema.CodeGeneration.Models;

namespace NJsonSchema.CodeGeneration.TypeScript.Models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@
<None Include="NuGetIcon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<Using Remove="System.Linq" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using System.Text.RegularExpressions;

namespace NJsonSchema.CodeGeneration.TypeScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using NJsonSchema.CodeGeneration.TypeScript.Models;

namespace NJsonSchema.CodeGeneration.TypeScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using System.Reflection;

namespace NJsonSchema.CodeGeneration.TypeScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;

namespace NJsonSchema.CodeGeneration.TypeScript
{
/// <summary>Manages the generated types and converts JSON types to TypeScript types. </summary>
Expand Down
1 change: 1 addition & 0 deletions src/NJsonSchema.CodeGeneration/CodeArtifactExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

using System.Linq;
using System.Text.RegularExpressions;

namespace NJsonSchema.CodeGeneration
Expand Down
5 changes: 3 additions & 2 deletions src/NJsonSchema.CodeGeneration/DefaultEnumNameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public string Generate(int index, string? name, object? value, JsonSchema schema
}
#pragma warning restore CA1845

return _invalidNameCharactersPattern.Replace(ConversionUtilities.ConvertToUpperCamelCase(name
.Replace(":", "-").Replace(@"""", ""), firstCharacterMustBeAlpha: true), "_");
var cleaned = name.Replace(':', '-').Replace(@"""", "");
var camelCase = ConversionUtilities.ConvertToUpperCamelCase(cleaned, firstCharacterMustBeAlpha: true);
return _invalidNameCharactersPattern.Replace(camelCase, "_");
}
}
}
Loading