Skip to content

Commit b183d3f

Browse files
Bump NJsonSchema from 11.5.2 to 11.6.0 (#3899)
* Bump NJsonSchema from 11.5.2 to 11.6.0 --- updated-dependencies: - dependency-name: NJsonSchema dependency-version: 11.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix tests Update all snapshots and scrub versions. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: martincostello <martin@martincostello.com>
1 parent 197ce55 commit b183d3f

File tree

22 files changed

+153
-144
lines changed

22 files changed

+153
-144
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
2424
<PackageVersion Include="MSBuild.ProjectCreation" Version="17.0.1" />
2525
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
26-
<PackageVersion Include="NJsonSchema" Version="11.5.2" />
26+
<PackageVersion Include="NJsonSchema" Version="11.6.0" />
2727
<PackageVersion Include="NSubstitute" Version="5.3.0" />
2828
<PackageVersion Include="NSwag.CodeGeneration.CSharp" Version="14.6.3" />
2929
<PackageVersion Include="NSwag.MSBuild" Version="14.6.3" />

test/Swashbuckle.AspNetCore.IntegrationTests/CodeGenerationTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
using System.Reflection;
44
using System.Security.Cryptography;
55
using System.Text;
6+
using System.Text.RegularExpressions;
67
using Microsoft.OpenApi;
78

89
namespace Swashbuckle.AspNetCore.IntegrationTests;
910

1011
/// <summary>
1112
/// Tests that validate that OpenAPI documents produce valid C# code when used with code generation tools.
1213
/// </summary>
13-
public class CodeGenerationTests(ITestOutputHelper outputHelper)
14+
public partial class CodeGenerationTests(ITestOutputHelper outputHelper)
1415
{
1516
private const string SnapshotsDirectory = "snapshots/code";
1617

@@ -87,6 +88,8 @@ await VerifyDirectory(
8788
options: new() { RecurseSubdirectories = true })
8889
.UseDirectory(SnapshotsDirectory)
8990
.UseFileName($"{nameof(GeneratesValidClient)}_{hashString}")
91+
.ScrubLinesWithReplace(line => GeneratedCodeRegex().Replace(line, "[GeneratedCode]"))
92+
.ScrubLinesWithReplace(line => NSwagGenerationComment().Replace(line, "// Generated using the NSwag toolchain"))
9093
.AddScrubber((builder) =>
9194
{
9295
var content = builder.ToString();
@@ -124,6 +127,12 @@ private static string GetProjectRoot() =>
124127
.GetCustomAttributes<AssemblyMetadataAttribute>()
125128
.First((p) => p.Key is "ProjectRoot")
126129
.Value!;
130+
131+
[GeneratedRegex(@"\[System\.CodeDom\.Compiler\.GeneratedCode\(\"".*\""\)]")]
132+
private static partial Regex GeneratedCodeRegex();
133+
134+
[GeneratedRegex(@"^// Generated using the NSwag toolchain.*$")]
135+
private static partial Regex NSwagGenerationComment();
127136
}
128137

129138
#endif

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/code/GeneratesValidClient_03bafa8999325463/NSwagOpenApiClient.verified.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//----------------------
22
// <auto-generated>
3-
// Generated using the NSwag toolchain v14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
3+
// Generated using the NSwag toolchain
44
// </auto-generated>
55
//----------------------
66

@@ -24,7 +24,7 @@ namespace Swashbuckle.AspNetCore.IntegrationTests.NSwagTests
2424
{
2525
using System = global::System;
2626

27-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
27+
[GeneratedCode]
2828
public partial class NSwagOpenApiClient
2929
{
3030
#pragma warning disable 8618
@@ -1016,7 +1016,7 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu
10161016
/// <summary>
10171017
/// Represents the model for creating a new Todo item.
10181018
/// </summary>
1019-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1019+
[GeneratedCode]
10201020
public partial class CreateTodoItemModel
10211021
{
10221022

@@ -1031,7 +1031,7 @@ public partial class CreateTodoItemModel
10311031
/// <summary>
10321032
/// Represents the model for a created Todo item.
10331033
/// </summary>
1034-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1034+
[GeneratedCode]
10351035
public partial class CreatedTodoItemModel
10361036
{
10371037

@@ -1043,7 +1043,7 @@ public partial class CreatedTodoItemModel
10431043

10441044
}
10451045

1046-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1046+
[GeneratedCode]
10471047
public partial class ProblemDetails
10481048
{
10491049

@@ -1076,7 +1076,7 @@ public System.Collections.Generic.IDictionary<string, object> AdditionalProperti
10761076
/// <summary>
10771077
/// Represents a Todo item.
10781078
/// </summary>
1079-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1079+
[GeneratedCode]
10801080
public partial class TodoItemModel
10811081
{
10821082

@@ -1122,7 +1122,7 @@ public partial class TodoItemModel
11221122
/// <summary>
11231123
/// Represents a collection of Todo items.
11241124
/// </summary>
1125-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1125+
[GeneratedCode]
11261126
public partial class TodoListViewModel
11271127
{
11281128

@@ -1137,7 +1137,7 @@ public partial class TodoListViewModel
11371137
/// <summary>
11381138
/// The priority levels for a Todo item.
11391139
/// </summary>
1140-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1140+
[GeneratedCode]
11411141
public enum TodoPriority
11421142
{
11431143

@@ -1155,7 +1155,7 @@ public enum TodoPriority
11551155
/// <summary>
11561156
/// Represents the model for updating the priority of a Todo item.
11571157
/// </summary>
1158-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1158+
[GeneratedCode]
11591159
public partial class UpdateTodoItemPriorityModel
11601160
{
11611161

@@ -1170,7 +1170,7 @@ public partial class UpdateTodoItemPriorityModel
11701170

11711171

11721172

1173-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1173+
[GeneratedCode]
11741174
public partial class ApiException : System.Exception
11751175
{
11761176
public int StatusCode { get; private set; }
@@ -1193,7 +1193,7 @@ public override string ToString()
11931193
}
11941194
}
11951195

1196-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
1196+
[GeneratedCode]
11971197
public partial class ApiException<TResult> : ApiException
11981198
{
11991199
public TResult Result { get; private set; }

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/code/GeneratesValidClient_0f40865eabf6c897/NSwagOpenApiClient.verified.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//----------------------
22
// <auto-generated>
3-
// Generated using the NSwag toolchain v14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
3+
// Generated using the NSwag toolchain
44
// </auto-generated>
55
//----------------------
66

@@ -24,7 +24,7 @@ namespace Swashbuckle.AspNetCore.IntegrationTests.NSwagTests
2424
{
2525
using System = global::System;
2626

27-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
27+
[GeneratedCode]
2828
public partial class NSwagOpenApiClient
2929
{
3030
#pragma warning disable 8618
@@ -2048,7 +2048,7 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu
20482048
}
20492049
}
20502050

2051-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2051+
[GeneratedCode]
20522052
public partial class Address
20532053
{
20542054

@@ -2066,7 +2066,7 @@ public partial class Address
20662066

20672067
}
20682068

2069-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2069+
[GeneratedCode]
20702070
public partial class AddressAnnotated
20712071
{
20722072

@@ -2087,7 +2087,7 @@ public partial class AddressAnnotated
20872087

20882088
}
20892089

2090-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2090+
[GeneratedCode]
20912091
public partial class AsParametersRecord
20922092
{
20932093

@@ -2131,7 +2131,7 @@ public partial class AsParametersRecord
21312131

21322132
}
21332133

2134-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2134+
[GeneratedCode]
21352135
public partial class CurrenciesRate
21362136
{
21372137

@@ -2149,7 +2149,7 @@ public partial class CurrenciesRate
21492149

21502150
}
21512151

2152-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2152+
[GeneratedCode]
21532153
public enum DateTimeKind
21542154
{
21552155

@@ -2164,7 +2164,7 @@ public enum DateTimeKind
21642164
/// <summary>
21652165
/// Description for Schema
21662166
/// </summary>
2167-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2167+
[GeneratedCode]
21682168
public partial class Fruit
21692169
{
21702170

@@ -2173,7 +2173,7 @@ public partial class Fruit
21732173

21742174
}
21752175

2176-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2176+
[GeneratedCode]
21772177
public partial class OrganizationCustomExchangeRatesDto
21782178
{
21792179

@@ -2185,7 +2185,7 @@ public partial class OrganizationCustomExchangeRatesDto
21852185

21862186
}
21872187

2188-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2188+
[GeneratedCode]
21892189
public partial class Person
21902190
{
21912191

@@ -2197,7 +2197,7 @@ public partial class Person
21972197

21982198
}
21992199

2200-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2200+
[GeneratedCode]
22012201
public partial class PersonAnnotated
22022202
{
22032203

@@ -2218,7 +2218,7 @@ public partial class PersonAnnotated
22182218
/// <summary>
22192219
/// Represents a product
22202220
/// </summary>
2221-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2221+
[GeneratedCode]
22222222
public partial class Product
22232223
{
22242224

@@ -2236,7 +2236,7 @@ public partial class Product
22362236

22372237
}
22382238

2239-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2239+
[GeneratedCode]
22402240
public partial class WeatherForecast
22412241
{
22422242

@@ -2255,7 +2255,7 @@ public partial class WeatherForecast
22552255

22562256
}
22572257

2258-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2258+
[GeneratedCode]
22592259
internal class DateFormatConverter : Newtonsoft.Json.Converters.IsoDateTimeConverter
22602260
{
22612261
public DateFormatConverter()
@@ -2264,7 +2264,7 @@ public DateFormatConverter()
22642264
}
22652265
}
22662266

2267-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2267+
[GeneratedCode]
22682268
public partial class FileParameter
22692269
{
22702270
public FileParameter(System.IO.Stream data)
@@ -2293,7 +2293,7 @@ public FileParameter(System.IO.Stream data, string fileName, string contentType)
22932293

22942294

22952295

2296-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2296+
[GeneratedCode]
22972297
public partial class ApiException : System.Exception
22982298
{
22992299
public int StatusCode { get; private set; }
@@ -2316,7 +2316,7 @@ public override string ToString()
23162316
}
23172317
}
23182318

2319-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
2319+
[GeneratedCode]
23202320
public partial class ApiException<TResult> : ApiException
23212321
{
23222322
public TResult Result { get; private set; }

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/code/GeneratesValidClient_0f9cab6ccf3bfed8/NSwagOpenApiClient.verified.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//----------------------
22
// <auto-generated>
3-
// Generated using the NSwag toolchain v14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
3+
// Generated using the NSwag toolchain
44
// </auto-generated>
55
//----------------------
66

@@ -24,7 +24,7 @@ namespace Swashbuckle.AspNetCore.IntegrationTests.NSwagTests
2424
{
2525
using System = global::System;
2626

27-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
27+
[GeneratedCode]
2828
public partial class NSwagOpenApiClient
2929
{
3030
#pragma warning disable 8618
@@ -358,7 +358,7 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu
358358
}
359359
}
360360

361-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
361+
[GeneratedCode]
362362
public partial class Todo
363363
{
364364

@@ -377,7 +377,7 @@ public partial class Todo
377377

378378
}
379379

380-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
380+
[GeneratedCode]
381381
internal class DateFormatConverter : Newtonsoft.Json.Converters.IsoDateTimeConverter
382382
{
383383
public DateFormatConverter()
@@ -388,7 +388,7 @@ public DateFormatConverter()
388388

389389

390390

391-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
391+
[GeneratedCode]
392392
public partial class ApiException : System.Exception
393393
{
394394
public int StatusCode { get; private set; }
@@ -411,7 +411,7 @@ public override string ToString()
411411
}
412412
}
413413

414-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
414+
[GeneratedCode]
415415
public partial class ApiException<TResult> : ApiException
416416
{
417417
public TResult Result { get; private set; }

test/Swashbuckle.AspNetCore.IntegrationTests/snapshots/code/GeneratesValidClient_1cc2852e2d07f7a9/NSwagOpenApiClient.verified.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//----------------------
22
// <auto-generated>
3-
// Generated using the NSwag toolchain v14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
3+
// Generated using the NSwag toolchain
44
// </auto-generated>
55
//----------------------
66

@@ -24,7 +24,7 @@ namespace Swashbuckle.AspNetCore.IntegrationTests.NSwagTests
2424
{
2525
using System = global::System;
2626

27-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
27+
[GeneratedCode]
2828
public partial class NSwagOpenApiClient
2929
{
3030
#pragma warning disable 8618
@@ -360,7 +360,7 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu
360360
}
361361
}
362362

363-
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
363+
[GeneratedCode]
364364
public enum LogLevel
365365
{
366366

@@ -382,7 +382,7 @@ public enum LogLevel
382382

383383

384384

385-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
385+
[GeneratedCode]
386386
public partial class ApiException : System.Exception
387387
{
388388
public int StatusCode { get; private set; }
@@ -405,7 +405,7 @@ public override string ToString()
405405
}
406406
}
407407

408-
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
408+
[GeneratedCode]
409409
public partial class ApiException<TResult> : ApiException
410410
{
411411
public TResult Result { get; private set; }

0 commit comments

Comments
 (0)