Skip to content

Commit 53521f2

Browse files
committed
Add Scalar UI module
1 parent 4156550 commit 53521f2

6 files changed

Lines changed: 53 additions & 1 deletion

File tree

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<PackageVersion Include="OrchardCoreContrib.Navigation.Core" Version="1.4.0" />
5454
<PackageVersion Include="OrchardCoreContrib.Sms.Abstractions" Version="1.4.0" />
5555
<PackageVersion Include="OrchardCoreContrib.OpenApi.Abstractions" Version="1.4.0" />
56+
<PackageVersion Include="Scalar.AspNetCore" Version="2.13.13" />
5657
<PackageVersion Include="SendGrid" Version="9.29.3" />
5758
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="2.1.5" />
5859
<PackageVersion Include="StackExchange.Redis" Version="2.8.31" />

OrchardCoreContrib.Modules.sln

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

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 18
4-
VisualStudioVersion = 18.1.11312.151 d18.0
4+
VisualStudioVersion = 18.1.11312.151
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C80A325F-F4C4-4C7B-A3CF-FB77CD8C9949}"
77
EndProject
@@ -82,6 +82,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCoreContrib.Cloudfla
8282
EndProject
8383
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCoreContrib.CloudflareTurnstile.Tests", "test\OrchardCoreContrib.CloudflareTurnstile.Tests\OrchardCoreContrib.CloudflareTurnstile.Tests.csproj", "{B2029246-BC23-4C18-B71A-55F13CB9E7AB}"
8484
EndProject
85+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrchardCoreContrib.Apis.Scalar", "src\OrchardCoreContrib.Apis.Scalar\OrchardCoreContrib.Apis.Scalar.csproj", "{3D421DD2-F842-4F5A-A95E-5AD8D3632712}"
86+
EndProject
8587
Global
8688
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8789
Debug|Any CPU = Debug|Any CPU
@@ -216,6 +218,10 @@ Global
216218
{B2029246-BC23-4C18-B71A-55F13CB9E7AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
217219
{B2029246-BC23-4C18-B71A-55F13CB9E7AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
218220
{B2029246-BC23-4C18-B71A-55F13CB9E7AB}.Release|Any CPU.Build.0 = Release|Any CPU
221+
{3D421DD2-F842-4F5A-A95E-5AD8D3632712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
222+
{3D421DD2-F842-4F5A-A95E-5AD8D3632712}.Debug|Any CPU.Build.0 = Debug|Any CPU
223+
{3D421DD2-F842-4F5A-A95E-5AD8D3632712}.Release|Any CPU.ActiveCfg = Release|Any CPU
224+
{3D421DD2-F842-4F5A-A95E-5AD8D3632712}.Release|Any CPU.Build.0 = Release|Any CPU
219225
EndGlobalSection
220226
GlobalSection(SolutionProperties) = preSolution
221227
HideSolutionNode = FALSE
@@ -253,6 +259,7 @@ Global
253259
{689A006D-0992-456E-86C9-66B7A2EE06A5} = {A239BFB0-9BA7-467C-AD41-405D0740633F}
254260
{1CF93DCB-2DF2-4E42-A37E-744F38D347C5} = {C80A325F-F4C4-4C7B-A3CF-FB77CD8C9949}
255261
{B2029246-BC23-4C18-B71A-55F13CB9E7AB} = {A239BFB0-9BA7-467C-AD41-405D0740633F}
262+
{3D421DD2-F842-4F5A-A95E-5AD8D3632712} = {C80A325F-F4C4-4C7B-A3CF-FB77CD8C9949}
256263
EndGlobalSection
257264
GlobalSection(ExtensibilityGlobals) = postSolution
258265
SolutionGuid = {48F73B05-7D3D-4ACF-81AE-A98B2B4EFDB2}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using OrchardCore.Modules.Manifest;
2+
3+
[assembly: Module(
4+
Name = "Scalar UI",
5+
Description = "Enables Scalar UI for Orchard Core APIs.",
6+
Dependencies = ["OrchardCoreContrib.Apis.Swagger"]
7+
)]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="OrchardCoreContrib.OpenApi.Abstractions" />
13+
<PackageReference Include="OrchardCore.Module.Targets" />
14+
<PackageReference Include="Scalar.AspNetCore" />
15+
</ItemGroup>
16+
17+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.AspNetCore.Routing;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using OrchardCore.Modules;
5+
using OrchardCoreContrib.OpenApi.Abstractions;
6+
using Scalar.AspNetCore;
7+
8+
namespace OrchardCoreContrib.Apis.Scalar;
9+
10+
public sealed class Startup : StartupBase
11+
{
12+
public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider)
13+
{
14+
var swaggerApiDefinition = serviceProvider.GetService<IOpenApiDefinition>();
15+
16+
routes.MapScalarApiReference(options =>
17+
options.OpenApiRoutePattern = $"/swagger/{swaggerApiDefinition.Version}/swagger.json");
18+
}
19+
}

src/OrchardCoreContrib.Modules.Web/OrchardCoreContrib.Modules.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88

99
<ItemGroup>
10+
<ProjectReference Include="..\OrchardCoreContrib.Apis.Scalar\OrchardCoreContrib.Apis.Scalar.csproj" />
1011
<ProjectReference Include="..\OrchardCoreContrib.Apis.Swagger\OrchardCoreContrib.Apis.Swagger.csproj" />
1112
<ProjectReference Include="..\OrchardCoreContrib.CloudflareTurnstile\OrchardCoreContrib.CloudflareTurnstile.csproj" />
1213
<ProjectReference Include="..\OrchardCoreContrib.ContentLocalization\OrchardCoreContrib.ContentLocalization.csproj" />

0 commit comments

Comments
 (0)