Skip to content

Commit 1f1749d

Browse files
deanmarcussenDean Marcussen
andauthored
General upgrade to nswag v14 and dotnet 8 (#39)
* General upgrade to nswag v14 and dotnet 8 * bump dotnet version * upgrade to OC 1.8.3 --------- Co-authored-by: Dean Marcussen <dean.marcussen@digitalconstructionworks.com>
1 parent 177a02e commit 1f1749d

File tree

19 files changed

+94
-74
lines changed

19 files changed

+94
-74
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup .NET Core
2020
uses: actions/setup-dotnet@v1
2121
with:
22-
dotnet-version: 6.0.x
22+
dotnet-version: 8.0.x
2323
- name: Install dependencies
2424
run: dotnet restore
2525
- name: Build

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup .NET Core
1515
uses: actions/setup-dotnet@v1
1616
with:
17-
dotnet-version: 6.0.x
17+
dotnet-version: 8.0.x
1818
- name: Install dependencies
1919
run: dotnet restore
2020
- name: Build

Directory.Build.targets

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
<Project>
22

33
<ItemGroup>
4-
<PackageReference Update="Newtonsoft.Json" Version="13.0.1" />
5-
<PackageReference Update="NJsonSchema" Version="10.8.0" />
6-
<PackageReference Update="NSwag.AspNetCore" Version="13.18.0" />
7-
<PackageReference Update="OrchardCore.Application.Cms.Targets" Version="1.5.0" />
8-
<PackageReference Update="OrchardCore.ContentFields" Version="1.5.0" />
9-
<PackageReference Update="OrchardCore.ContentManagement" Version="1.5.0" />
10-
<PackageReference Update="OrchardCore.ContentManagement.Abstractions" Version="1.5.0" />
11-
<PackageReference Update="OrchardCore.Contents.Core" Version="1.5.0" />
12-
<PackageReference Update="OrchardCore.ContentTypes.Abstractions" Version="1.5.0" />
13-
<PackageReference Update="OrchardCore.DisplayManagement" Version="1.5.0" />
14-
<PackageReference Update="OrchardCore.Flows" Version="1.5.0" />
15-
<PackageReference Update="OrchardCore.Html" Version="1.5.0" />
16-
<PackageReference Update="OrchardCore.Lists" Version="1.5.0" />
17-
<PackageReference Update="OrchardCore.Infrastructure" Version="1.5.0" />
18-
<PackageReference Update="OrchardCore.Logging.NLog" Version="1.5.0" />
19-
<PackageReference Update="OrchardCore.Module.Targets" Version="1.5.0" />
20-
<PackageReference Update="OrchardCore.ResourceManagement" Version="1.5.0" />
21-
<PackageReference Update="OrchardCore.Theme.Targets" Version="1.5.0" />
4+
<PackageReference Update="Newtonsoft.Json" Version="13.0.3" />
5+
<PackageReference Update="NJsonSchema" Version="11.0.2" />
6+
<PackageReference Update="NSwag.AspNetCore" Version="14.1.0" />
7+
<PackageReference Update="OrchardCore.Application.Cms.Targets" Version="1.8.3" />
8+
<PackageReference Update="OrchardCore.ContentFields" Version="1.8.3" />
9+
<PackageReference Update="OrchardCore.ContentManagement" Version="1.8.3" />
10+
<PackageReference Update="OrchardCore.ContentManagement.Abstractions" Version="1.8.3" />
11+
<PackageReference Update="OrchardCore.Contents.Core" Version="1.8.3" />
12+
<PackageReference Update="OrchardCore.ContentTypes.Abstractions" Version="1.8.3" />
13+
<PackageReference Update="OrchardCore.DisplayManagement" Version="1.8.3" />
14+
<PackageReference Update="OrchardCore.Flows" Version="1.8.3" />
15+
<PackageReference Update="OrchardCore.Html" Version="1.8.3" />
16+
<PackageReference Update="OrchardCore.Lists" Version="1.8.3" />
17+
<PackageReference Update="OrchardCore.Infrastructure" Version="1.8.3" />
18+
<PackageReference Update="OrchardCore.Logging.NLog" Version="1.8.3" />
19+
<PackageReference Update="OrchardCore.Module.Targets" Version="1.8.3" />
20+
<PackageReference Update="OrchardCore.ResourceManagement" Version="1.8.3" />
21+
<PackageReference Update="OrchardCore.Theme.Targets" Version="1.8.3" />
2222
</ItemGroup>
23-
</Project>
23+
</Project>

ThisNetWorks.OrchardCore.OpenApi.sln

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30114.105
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisNetWorks.OrchardCore.OpenApi", "src\ThisNetWorks.OrchardCore.OpenApi\ThisNetWorks.OrchardCore.OpenApi.csproj", "{CE8911A8-8769-4958-B9B6-873D53853ED7}"
77
EndProject
@@ -23,6 +23,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisNetWorks.OrchardCore.Op
2323
EndProject
2424
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisNetWorks.OrchardCore.OpenApi.SampleModels", "samples\ThisNetWorks.OrchardCore.OpenApi.SampleModels\ThisNetWorks.OrchardCore.OpenApi.SampleModels.csproj", "{A1370FC8-40E2-45A3-B9D8-0810C8B2ADD6}"
2525
EndProject
26+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisNetWorks.OrchardCore.OpenApi.ConsoleClient", "samples\ThisNetWorks.OrchardCore.OpenApi.ConsoleClient\ThisNetWorks.OrchardCore.OpenApi.ConsoleClient.csproj", "{FE33358F-A87E-42CA-8204-2125DA8622A0}"
27+
EndProject
2628
Global
2729
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2830
Debug|Any CPU = Debug|Any CPU
@@ -72,6 +74,12 @@ Global
7274
{A1370FC8-40E2-45A3-B9D8-0810C8B2ADD6}.DebugOpenApi|Any CPU.Build.0 = Debug|Any CPU
7375
{A1370FC8-40E2-45A3-B9D8-0810C8B2ADD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
7476
{A1370FC8-40E2-45A3-B9D8-0810C8B2ADD6}.Release|Any CPU.Build.0 = Release|Any CPU
77+
{FE33358F-A87E-42CA-8204-2125DA8622A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
78+
{FE33358F-A87E-42CA-8204-2125DA8622A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
79+
{FE33358F-A87E-42CA-8204-2125DA8622A0}.DebugOpenApi|Any CPU.ActiveCfg = Debug|Any CPU
80+
{FE33358F-A87E-42CA-8204-2125DA8622A0}.DebugOpenApi|Any CPU.Build.0 = Debug|Any CPU
81+
{FE33358F-A87E-42CA-8204-2125DA8622A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
82+
{FE33358F-A87E-42CA-8204-2125DA8622A0}.Release|Any CPU.Build.0 = Release|Any CPU
7583
EndGlobalSection
7684
GlobalSection(SolutionProperties) = preSolution
7785
HideSolutionNode = FALSE
@@ -84,6 +92,7 @@ Global
8492
{CFC87DD8-1FA2-42C6-B930-3796C46AFFF0} = {8C451866-7272-45C2-BA76-4248E11155EC}
8593
{9415CCCA-F0BA-48D7-8F0B-04D81911D076} = {8C451866-7272-45C2-BA76-4248E11155EC}
8694
{A1370FC8-40E2-45A3-B9D8-0810C8B2ADD6} = {8C451866-7272-45C2-BA76-4248E11155EC}
95+
{FE33358F-A87E-42CA-8204-2125DA8622A0} = {8C451866-7272-45C2-BA76-4248E11155EC}
8796
EndGlobalSection
8897
GlobalSection(ExtensibilityGlobals) = postSolution
8998
SolutionGuid = {EF1A5E30-9076-4572-B772-5ACD6F440A24}

samples/ThisNetWorks.OrchardCore.OpenApi.ConsoleClient/ThisNetWorks.OrchardCore.OpenApi.ConsoleClient.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
9+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1010
</ItemGroup>
1111

1212
</Project>

samples/ThisNetWorks.OrchardCore.OpenApi.Sample/ThisNetWorks.OrchardCore.OpenApi.Sample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
<RazorRuntimeCompilation>false</RazorRuntimeCompilation>
77
</PropertyGroup>

samples/ThisNetWorks.OrchardCore.OpenApi.SampleModels/ThisNetWorks.OrchardCore.OpenApi.SampleModels.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
66
</PropertyGroup>
77

samples/ThisNetWorks.OrchardCore.OpenApi.SampleModule/Drivers/SamplePartDisplayDriver.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,43 @@ public SamplePartDisplayDriver(IContentDefinitionManager contentDefinitionManage
2222
public override IDisplayResult Display(SamplePart SamplePart)
2323
{
2424
return Combine(
25-
Initialize<SamplePartViewModel>("SamplePart", m => BuildViewModel(m, SamplePart))
25+
Initialize<SamplePartViewModel>("SamplePart", async vm =>await BuildViewModelAsync(vm, SamplePart))
2626
.Location("Detail", "Content:20"),
27-
Initialize<SamplePartViewModel>("SamplePart_Summary", m => BuildViewModel(m, SamplePart))
27+
Initialize<SamplePartViewModel>("SamplePart_Summary", async m =>await BuildViewModelAsync(m, SamplePart))
2828
.Location("Summary", "Meta:5")
2929
);
3030
}
3131

3232
public override IDisplayResult Edit(SamplePart SamplePart)
3333
{
34-
return Initialize<SamplePartViewModel>("SamplePart_Edit", m => BuildViewModel(m, SamplePart));
34+
return Initialize<SamplePartViewModel>("SamplePart_Edit", async vm => await BuildViewModelAsync(vm, SamplePart));
3535
}
3636

3737
public override async Task<IDisplayResult> UpdateAsync(SamplePart model, IUpdateModel updater)
3838
{
39-
var settings = GetSamplePartSettings(model);
40-
4139
await updater.TryUpdateModelAsync(model, Prefix, t => t.Show);
4240

4341
return Edit(model);
4442
}
4543

46-
public SamplePartSettings GetSamplePartSettings(SamplePart part)
44+
public async Task<SamplePartSettings> GetSamplePartSettingsAsync(SamplePart part)
4745
{
48-
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(part.ContentItem.ContentType);
46+
var contentTypeDefinition = await _contentDefinitionManager.GetTypeDefinitionAsync(part.ContentItem.ContentType);
4947
var contentTypePartDefinition = contentTypeDefinition.Parts.FirstOrDefault(p => p.PartDefinition.Name == nameof(SamplePart));
5048
var settings = contentTypePartDefinition.GetSettings<SamplePartSettings>();
5149

5250
return settings;
5351
}
5452

55-
private Task BuildViewModel(SamplePartViewModel model, SamplePart part)
53+
private async Task BuildViewModelAsync(SamplePartViewModel model, SamplePart part)
5654
{
57-
var settings = GetSamplePartSettings(part);
55+
var settings = await GetSamplePartSettingsAsync(part);
5856

5957
model.ContentItem = part.ContentItem;
6058
model.MySetting = settings.MySetting;
6159
model.Show = part.Show;
6260
model.SamplePart = part;
6361
model.Settings = settings;
64-
65-
return Task.CompletedTask;
6662
}
6763
}
6864
}

samples/ThisNetWorks.OrchardCore.OpenApi.SampleModule/Migrations.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ IRecipeMigrator recipeMigrator
2121
_recipeMigrator = recipeMigrator;
2222
}
2323

24-
public int Create()
24+
public async Task<int> CreateAsync()
2525
{
26-
_contentDefinitionManager.AlterPartDefinition("SamplePart", builder => builder
26+
await _contentDefinitionManager.AlterPartDefinitionAsync("SamplePart", builder => builder
2727
.Attachable()
2828
.WithDescription("Provides a Sample part for your content item.")
2929
.WithField("MyTextField", field => field
@@ -35,19 +35,19 @@ public int Create()
3535
}
3636

3737
// This creates some useful type definitions for bag parts.
38-
public int UpdateFrom1()
38+
public async Task<int> UpdateFrom1Async()
3939
{
40-
_contentDefinitionManager.AlterTypeDefinition("Bar", type => type
40+
await _contentDefinitionManager.AlterTypeDefinitionAsync("Bar", type => type
4141
.DisplayedAs("Bar")
4242
.WithPart("HtmlBodyPart")
4343
);
4444

45-
_contentDefinitionManager.AlterTypeDefinition("Foo", type => type
45+
await _contentDefinitionManager.AlterTypeDefinitionAsync("Foo", type => type
4646
.DisplayedAs("Foo")
4747
.WithPart("MarkdownBodyPart")
4848
);
4949

50-
_contentDefinitionManager.AlterTypeDefinition("Bag", type => type
50+
await _contentDefinitionManager.AlterTypeDefinitionAsync("Bag", type => type
5151
.DisplayedAs("Bag container")
5252
.Listable()
5353
.Creatable()
@@ -67,9 +67,9 @@ public int UpdateFrom1()
6767
}
6868

6969
// This adds a field to the HtmlBodyPart
70-
public int UpdateFrom2()
70+
public async Task<int> UpdateFrom2Async()
7171
{
72-
_contentDefinitionManager.AlterPartDefinition("HtmlBodyPart", part => part
72+
await _contentDefinitionManager.AlterPartDefinitionAsync("HtmlBodyPart", part => part
7373
.WithField("FooField", field => field
7474
.OfType("TextField")
7575
.WithDisplayName("Foo Field")
@@ -79,16 +79,16 @@ public int UpdateFrom2()
7979
return 3;
8080
}
8181

82-
public int UpdateFrom3()
82+
public async Task<int> UpdateFrom3Async()
8383
{
84-
_contentDefinitionManager.AlterTypeDefinition("FooText", type => type
84+
await _contentDefinitionManager.AlterTypeDefinitionAsync("FooText", type => type
8585
.Securable()
8686
.Versionable()
8787
.DisplayedAs("Foo text")
8888
.WithPart("FooText")
8989
);
9090

91-
_contentDefinitionManager.AlterPartDefinition("FooText", part => part
91+
await _contentDefinitionManager.AlterPartDefinitionAsync("FooText", part => part
9292
.WithField("FooField", field => field
9393
.OfType("TextField")
9494
.WithDisplayName("Foo Field")
@@ -98,9 +98,9 @@ public int UpdateFrom3()
9898
return 4;
9999
}
100100

101-
public int UpdateFrom4()
101+
public async Task<int> UpdateFrom4Async()
102102
{
103-
_contentDefinitionManager.AlterTypeDefinition("FooTextContainer", type => type
103+
await _contentDefinitionManager.AlterTypeDefinitionAsync("FooTextContainer", type => type
104104
.DisplayedAs("Foo text container")
105105
.Listable()
106106
.Securable()

samples/ThisNetWorks.OrchardCore.OpenApi.SampleModule/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public override void ConfigureServices(IServiceCollection services)
7575
generator.OperationProcessors.Add(
7676
new AspNetCoreOperationSecurityScopeProcessor("bearer"));
7777
});
78-
o.Middleware.SwaggerUi3Settings = (swagger) =>
78+
o.Middleware.SwaggerUISettings = (swagger) =>
7979
{
8080
swagger.OAuth2Client = new OAuth2ClientSettings
8181
{

0 commit comments

Comments
 (0)