Skip to content

Commit

Permalink
📦 Upgrade to NSwag 14.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontaylordev committed Feb 15, 2024
1 parent e9e1a0d commit 2fc2e84
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"generator": "constant",
"replaces": "caPackageVersion",
"parameters": {
"value": "8.0.2"
"value": "8.0.3"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion CleanArchitecture.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>

<id>Clean.Architecture.Solution.Template</id>
<version>8.0.2</version>
<version>8.0.3</version>
<title>Clean Architecture Solution Template</title>
<authors>JasonTaylorDev</authors>
<description>Clean Architecture Solution Template for .NET 8.</description>
Expand Down
5 changes: 2 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Moq" Version="4.20.69" />
<PackageVersion Include="NSwag.AspNetCore" Version="14.0.0-preview010" />
<PackageVersion Include="NSwag.MSBuild" Version="14.0.0-preview010" />
<PackageVersion Include="NSwag.AspNetCore" Version="14.0.3" />
<PackageVersion Include="NSwag.MSBuild" Version="14.0.3" />
<PackageVersion Include="nunit" Version="3.14.0" />
<PackageVersion Include="NUnit.Analyzers" Version="3.9.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Respawn" Version="6.1.0" />
<PackageVersion Include="Testcontainers.MsSql" Version="3.6.0" />
<PackageVersion Include="ZymLabs.NSwag.FluentValidation.AspNetCore" Version="0.6.2" />
<!--#if(!UseApiOnly)-->
<PackageVersion Include="Microsoft.Playwright" Version="1.40.0" />
<PackageVersion Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.57" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you find this project useful, please give it a star. Thanks! ⭐

The easiest way to get started is to install the [.NET template](https://www.nuget.org/packages/Clean.Architecture.Solution.Template):
```
dotnet new install Clean.Architecture.Solution.Template::8.0.0
dotnet new install Clean.Architecture.Solution.Template::8.0.3
```

Once installed, create a new solution using the template. You can choose to use Angular, React, or create a Web API-only solution. Specify the client framework using the `-cf` or `--client-framework` option, and provide the output directory where your project will be created. Here are some examples:
Expand Down
18 changes: 9 additions & 9 deletions src/Web/ClientApp-React/src/web-api-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// Generated using the NSwag toolchain v14.0.3.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------

Expand Down Expand Up @@ -543,7 +543,7 @@ export interface ITodoItemBriefDto {

export class CreateTodoItemCommand implements ICreateTodoItemCommand {
listId?: number;
title!: string;
title?: string | undefined;

constructor(data?: ICreateTodoItemCommand) {
if (data) {
Expand Down Expand Up @@ -578,12 +578,12 @@ export class CreateTodoItemCommand implements ICreateTodoItemCommand {

export interface ICreateTodoItemCommand {
listId?: number;
title: string;
title?: string | undefined;
}

export class UpdateTodoItemCommand implements IUpdateTodoItemCommand {
id?: number;
title!: string;
title?: string | undefined;
done?: boolean;

constructor(data?: IUpdateTodoItemCommand) {
Expand Down Expand Up @@ -621,7 +621,7 @@ export class UpdateTodoItemCommand implements IUpdateTodoItemCommand {

export interface IUpdateTodoItemCommand {
id?: number;
title: string;
title?: string | undefined;
done?: boolean;
}

Expand Down Expand Up @@ -889,7 +889,7 @@ export interface ITodoItemDto {
}

export class CreateTodoListCommand implements ICreateTodoListCommand {
title!: string;
title?: string | undefined;

constructor(data?: ICreateTodoListCommand) {
if (data) {
Expand Down Expand Up @@ -921,12 +921,12 @@ export class CreateTodoListCommand implements ICreateTodoListCommand {
}

export interface ICreateTodoListCommand {
title: string;
title?: string | undefined;
}

export class UpdateTodoListCommand implements IUpdateTodoListCommand {
id?: number;
title!: string;
title?: string | undefined;

constructor(data?: IUpdateTodoListCommand) {
if (data) {
Expand Down Expand Up @@ -961,7 +961,7 @@ export class UpdateTodoListCommand implements IUpdateTodoListCommand {

export interface IUpdateTodoListCommand {
id?: number;
title: string;
title?: string | undefined;
}

export class WeatherForecast implements IWeatherForecast {
Expand Down
18 changes: 9 additions & 9 deletions src/Web/ClientApp/src/app/web-api-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// Generated using the NSwag toolchain v14.0.3.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------

Expand Down Expand Up @@ -706,7 +706,7 @@ export interface ITodoItemBriefDto {

export class CreateTodoItemCommand implements ICreateTodoItemCommand {
listId?: number;
title!: string | undefined;
title?: string | undefined;

constructor(data?: ICreateTodoItemCommand) {
if (data) {
Expand Down Expand Up @@ -741,12 +741,12 @@ export class CreateTodoItemCommand implements ICreateTodoItemCommand {

export interface ICreateTodoItemCommand {
listId?: number;
title: string | undefined;
title?: string | undefined;
}

export class UpdateTodoItemCommand implements IUpdateTodoItemCommand {
id?: number;
title!: string | undefined;
title?: string | undefined;
done?: boolean;

constructor(data?: IUpdateTodoItemCommand) {
Expand Down Expand Up @@ -784,7 +784,7 @@ export class UpdateTodoItemCommand implements IUpdateTodoItemCommand {

export interface IUpdateTodoItemCommand {
id?: number;
title: string | undefined;
title?: string | undefined;
done?: boolean;
}

Expand Down Expand Up @@ -1052,7 +1052,7 @@ export interface ITodoItemDto {
}

export class CreateTodoListCommand implements ICreateTodoListCommand {
title!: string | undefined;
title?: string | undefined;

constructor(data?: ICreateTodoListCommand) {
if (data) {
Expand Down Expand Up @@ -1084,12 +1084,12 @@ export class CreateTodoListCommand implements ICreateTodoListCommand {
}

export interface ICreateTodoListCommand {
title: string | undefined;
title?: string | undefined;
}

export class UpdateTodoListCommand implements IUpdateTodoListCommand {
id?: number;
title!: string | undefined;
title?: string | undefined;

constructor(data?: IUpdateTodoListCommand) {
if (data) {
Expand Down Expand Up @@ -1124,7 +1124,7 @@ export class UpdateTodoListCommand implements IUpdateTodoListCommand {

export interface IUpdateTodoListCommand {
id?: number;
title: string | undefined;
title?: string | undefined;
}

export class WeatherForecast implements IWeatherForecast {
Expand Down
16 changes: 0 additions & 16 deletions src/Web/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using NSwag;
using NSwag.Generation.Processors.Security;
#endif
using ZymLabs.NSwag.FluentValidation;

namespace Microsoft.Extensions.DependencyInjection;

Expand All @@ -29,14 +28,6 @@ public static IServiceCollection AddWebServices(this IServiceCollection services

services.AddRazorPages();

services.AddScoped(provider =>
{
var validationRules = provider.GetService<IEnumerable<FluentValidationRule>>();
var loggerFactory = provider.GetService<ILoggerFactory>();

return new FluentValidationSchemaProcessor(provider, validationRules, loggerFactory);
});

// Customise default API behaviour
services.Configure<ApiBehaviorOptions>(options =>
options.SuppressModelStateInvalidFilter = true);
Expand All @@ -47,13 +38,6 @@ public static IServiceCollection AddWebServices(this IServiceCollection services
{
configure.Title = "CleanArchitecture API";


// Add the fluent validations schema processor
var fluentValidationSchemaProcessor =
sp.CreateScope().ServiceProvider.GetRequiredService<FluentValidationSchemaProcessor>();

configure.SchemaSettings.SchemaProcessors.Add(fluentValidationSchemaProcessor);

#if (UseApiOnly)
// Add JWT
configure.AddSecurity("JWT", Enumerable.Empty<string>(), new OpenApiSecurityScheme
Expand Down
2 changes: 1 addition & 1 deletion src/Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
app.UseHealthChecks("/health");
app.UseHttpsRedirection();
app.UseStaticFiles();


app.UseSwaggerUi(settings =>
{
settings.Path = "/api";
Expand Down
1 change: 0 additions & 1 deletion src/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentValidation.AspNetCore" />
<PackageReference Include="ZymLabs.NSwag.FluentValidation.AspNetCore" />
</ItemGroup>

<!--#if (!UseApiOnly)-->
Expand Down
22 changes: 1 addition & 21 deletions src/Web/wwwroot/api/specification.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"x-generator": "NSwag v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))",
"x-generator": "NSwag v14.0.3.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "CleanArchitecture API",
Expand Down Expand Up @@ -377,37 +377,27 @@
"CreateTodoItemCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"title"
],
"properties": {
"listId": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"maxLength": 200,
"minLength": 0,
"nullable": true
}
}
},
"UpdateTodoItemCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"title"
],
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"maxLength": 200,
"minLength": 0,
"nullable": true
},
"done": {
Expand Down Expand Up @@ -540,33 +530,23 @@
"CreateTodoListCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"title"
],
"properties": {
"title": {
"type": "string",
"maxLength": 200,
"minLength": 0,
"nullable": true
}
}
},
"UpdateTodoListCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"title"
],
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string",
"maxLength": 200,
"minLength": 0,
"nullable": true
}
}
Expand Down

0 comments on commit 2fc2e84

Please sign in to comment.