Skip to content

Commit 01c3cfa

Browse files
committed
NSwag generate without Client project
1 parent f4327fd commit 01c3cfa

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/Ahk.GradeManagement/Ahk.GradeManagement.Api/Ahk.GradeManagement.Api.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929
<PackageReference Include="NSwag.AspNetCore" Version="14.4.0" />
3030
</ItemGroup>
3131

32-
<ItemGroup>
32+
<ItemGroup Condition=" '$(Configuration)' != 'NSwag.Generate' ">
3333
<ProjectReference Include="..\Ahk.GradeManagement.Client\Ahk.GradeManagement.Client.csproj" />
34+
</ItemGroup>
35+
36+
<ItemGroup>
3437
<ProjectReference Include="..\Ahk.GradeManagement.Dal\Ahk.GradeManagement.Dal.csproj" />
3538
<ProjectReference Include="..\Ahk.GradeManagement.Bll\Ahk.GradeManagement.Bll.csproj" />
3639
<ProjectReference Include="..\Ahk.GradeManagement.Shared\Ahk.GradeManagement.Shared.csproj" />

src/Ahk.GradeManagement/Ahk.GradeManagement.Client/Ahk.GradeManagement.Client.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
<Target Name="NSwag">
3636
<Copy SourceFiles="@(ReferencePath)" DestinationFolder="$(OutDir)References" />
37-
<Exec Command="$(NSwagExe_Net80) run Network/ApiClients.nswag /variables:Configuration=$(Configuration),OutDir=$(OutDir)" />
37+
<Exec Command="$(NSwagExe_Net80) run Network/ApiClients.nswag /variables:OutDir=$(OutDir)" />
3838
<RemoveDir Directories="$(OutDir)References" />
3939
</Target>
4040

src/Ahk.GradeManagement/Ahk.GradeManagement.Client/Network/ApiClients.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
//----------------------
66

77
using Ahk.GradeManagement.Shared.Dtos;
8-
using Ahk.GradeManagement.Shared.Dtos.AssignmentEvents;
9-
using Ahk.GradeManagement.Shared.Dtos.ErrorHandling;
108
using Ahk.GradeManagement.Shared.Dtos.Request;
119
using Ahk.GradeManagement.Shared.Dtos.Response;
10+
using Ahk.GradeManagement.Shared.Dtos.AssignmentEvents;
11+
using Ahk.GradeManagement.Shared.Dtos.ErrorHandling;
1212

1313
#pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended."
1414
#pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword."

src/Ahk.GradeManagement/Ahk.GradeManagement.Client/Network/ApiClients.nswag

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"aspNetCoreToOpenApi": {
66
"project": "../../Ahk.GradeManagement.Api/Ahk.GradeManagement.Api.csproj",
77
"msBuildProjectExtensionsPath": null,
8-
"configuration": null,
8+
// Api project does not reference Client project when NSwag.Generate configuration is used
9+
// so we can generate the OpenAPI document without building the Client project
10+
"configuration": "NSwag.Generate",
911
"runtime": null,
1012
"targetFramework": null,
1113
"noBuild": false,
@@ -30,7 +32,7 @@
3032
"serviceHost": null,
3133
"serviceBasePath": null,
3234
"serviceSchemes": [],
33-
"infoTitle": "My Title",
35+
"infoTitle": "AHK2.OpenAPI",
3436
"infoDescription": null,
3537
"infoVersion": "1.0.0",
3638
"documentTemplate": null,

0 commit comments

Comments
 (0)