File tree 2 files changed +20
-17
lines changed
samples/datasync-server/src/Sample.Datasync.Server
2 files changed +20
-17
lines changed Original file line number Diff line number Diff line change 4
4
5
5
using CommunityToolkit . Datasync . Server ;
6
6
using CommunityToolkit . Datasync . Server . NSwag ;
7
+ using CommunityToolkit . Datasync . Server . OpenApi ;
7
8
using CommunityToolkit . Datasync . Server . Swashbuckle ;
8
9
using Microsoft . EntityFrameworkCore ;
9
10
using Sample . Datasync . Server . Db ;
33
34
_ = builder . Services . AddSwaggerGen ( options => options . AddDatasyncControllers ( ) ) ;
34
35
}
35
36
36
- // if (openApiEnabled)
37
- // {
38
- // _ = builder.Services.AddOpenApi(options => options.AddDatasyncTransformers());
39
- // }
37
+ if ( openApiEnabled )
38
+ {
39
+ _ = builder . Services . AddOpenApi ( options => options . AddDatasyncTransformers ( ) ) ;
40
+ }
40
41
41
42
WebApplication app = builder . Build ( ) ;
42
43
59
60
_ = app . UseSwagger ( ) . UseSwaggerUI ( ) ;
60
61
}
61
62
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
+
62
69
app . UseAuthorization ( ) ;
63
70
app . MapControllers ( ) ;
64
71
65
- //if (openApiEnabled)
66
- //{
67
- // _ = app.MapOpenApi(pattern: "swagger/{documentName}/swagger.json");
68
- //}
69
-
70
72
app . 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" >
2
2
<PropertyGroup >
3
3
<TargetFramework >net9.0</TargetFramework >
4
4
<Nullable >enable</Nullable >
7
7
</PropertyGroup >
8
8
9
9
<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" >
17
18
<PrivateAssets >all</PrivateAssets >
18
19
<IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
19
20
</PackageReference >
You can’t perform that action at this time.
0 commit comments