File tree Expand file tree Collapse file tree 2 files changed +20
-17
lines changed
samples/datasync-server/src/Sample.Datasync.Server Expand file tree Collapse file tree 2 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 44
55using CommunityToolkit . Datasync . Server ;
66using CommunityToolkit . Datasync . Server . NSwag ;
7+ using CommunityToolkit . Datasync . Server . OpenApi ;
78using CommunityToolkit . Datasync . Server . Swashbuckle ;
89using Microsoft . EntityFrameworkCore ;
910using Sample . Datasync . Server . Db ;
3334 _ = builder . Services . AddSwaggerGen ( options => options . AddDatasyncControllers ( ) ) ;
3435}
3536
36- // if (openApiEnabled)
37- // {
38- // _ = builder.Services.AddOpenApi(options => options.AddDatasyncTransformers());
39- // }
37+ if ( openApiEnabled )
38+ {
39+ _ = builder . Services . AddOpenApi ( options => options . AddDatasyncTransformers ( ) ) ;
40+ }
4041
4142WebApplication app = builder . Build ( ) ;
4243
5960 _ = app . UseSwagger ( ) . UseSwaggerUI ( ) ;
6061}
6162
63+ if ( openApiEnabled )
64+ {
65+ _ = app . MapOpenApi ( pattern : "swagger/{documentName}/swagger.json" ) ;
66+ _ = app . UseSwaggerUI ( options => options . SwaggerEndpoint ( "/swagger/v1/swagger.json" , "Sample.Datasync.Server v1" ) ) ;
67+ }
68+
6269app . UseAuthorization ( ) ;
6370app . MapControllers ( ) ;
6471
65- //if (openApiEnabled)
66- //{
67- // _ = app.MapOpenApi(pattern: "swagger/{documentName}/swagger.json");
68- //}
69-
7072app . Run ( ) ;
Original file line number Diff line number Diff line change 1- <Project Sdk =" Microsoft.NET.Sdk.Web" >
1+ <Project Sdk =" Microsoft.NET.Sdk.Web" >
22 <PropertyGroup >
33 <TargetFramework >net9.0</TargetFramework >
44 <Nullable >enable</Nullable >
77 </PropertyGroup >
88
99 <ItemGroup >
10- <PackageReference Include =" CommunityToolkit.Datasync.Server" Version =" 9.0.0" />
11- <PackageReference Include =" CommunityToolkit.Datasync.Server.EntityFrameworkCore" Version =" 9.0.0" />
12- <PackageReference Include =" CommunityToolkit.Datasync.Server.NSwag" Version =" 9.0.0" />
13- <PackageReference Include =" CommunityToolkit.Datasync.Server.Swashbuckle" Version =" 9.0.0" />
14- <PackageReference Include =" Microsoft.AspNetCore.OpenApi" Version =" 9.0.1" />
15- <PackageReference Include =" Microsoft.EntityFrameworkCore.SqlServer" Version =" 9.0.1" />
16- <PackageReference Include =" Microsoft.EntityFrameworkCore.Tools" Version =" 9.0.1" >
10+ <PackageReference Include =" CommunityToolkit.Datasync.Server" Version =" 9.0.1" />
11+ <PackageReference Include =" CommunityToolkit.Datasync.Server.EntityFrameworkCore" Version =" 9.0.1" />
12+ <PackageReference Include =" CommunityToolkit.Datasync.Server.NSwag" Version =" 9.0.1" />
13+ <PackageReference Include =" CommunityToolkit.Datasync.Server.OpenApi" Version =" 9.0.1" />
14+ <PackageReference Include =" CommunityToolkit.Datasync.Server.Swashbuckle" Version =" 9.0.1" />
15+ <PackageReference Include =" Microsoft.AspNetCore.OpenApi" Version =" 9.0.2" />
16+ <PackageReference Include =" Microsoft.EntityFrameworkCore.SqlServer" Version =" 9.0.2" />
17+ <PackageReference Include =" Microsoft.EntityFrameworkCore.Tools" Version =" 9.0.2" >
1718 <PrivateAssets >all</PrivateAssets >
1819 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
1920 </PackageReference >
You can’t perform that action at this time.
0 commit comments