-
-
Save generalgw/302fb2e4384b1363c411f738e9e0a533 to your computer and use it in GitHub Desktop.
Revisions
-
dj-nitehawk revised this gist
Sep 13, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public override void Configure() { Get("say-hello"); AllowAnonymous(); Version(0, deprecateAt: 1); // specify when to deprecate } public override Task HandleAsync(CancellationToken c) @@ -54,7 +54,7 @@ class MyEndpoint_V1 : MyEndpoint public override void Configure() { base.Configure(); Version(1, deprecateAt: 2); // specify when to deprecate } } @@ -63,6 +63,6 @@ class MyEndpoint_V2 : MyEndpoint public override void Configure() { base.Configure(); Version(2); // latest version doesn't need to specify deprecation } } -
dj-nitehawk revised this gist
Sep 13, 2023 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ .SwaggerDocument(o => { o.MaxEndpointVersion = 1; o.ShowDeprecatedOps = true; // specify to show deprecated versions o.DocumentSettings = s => { s.DocumentName = "Release 1"; @@ -22,7 +22,7 @@ .SwaggerDocument(o => { o.MaxEndpointVersion = 2; o.ShowDeprecatedOps = true; // specify to show deprecated versions o.DocumentSettings = s => { s.DocumentName = "Release 2"; @@ -42,7 +42,7 @@ public override void Configure() { Get("say-hello"); AllowAnonymous(); Version(0, deprecateAt: 1); // every endpoint needs to specify deprecation } public override Task HandleAsync(CancellationToken c) @@ -54,7 +54,7 @@ class MyEndpoint_V1 : MyEndpoint public override void Configure() { base.Configure(); Version(1, deprecateAt: 2); // every endpoint needs to specify deprecation } } @@ -63,6 +63,6 @@ class MyEndpoint_V2 : MyEndpoint public override void Configure() { base.Configure(); Version(2, deprecateAt: 3); // every endpoint needs to specify deprecation } } -
dj-nitehawk created this gist
Sep 13, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ var bld = WebApplication.CreateBuilder(); bld.Services .AddFastEndpoints() .SwaggerDocument(o => { o.DocumentSettings = s => { s.DocumentName = "Initial Release"; s.Version = "v0"; }; }) .SwaggerDocument(o => { o.MaxEndpointVersion = 1; o.ShowDeprecatedOps = true; o.DocumentSettings = s => { s.DocumentName = "Release 1"; s.Version = "v1"; }; }) .SwaggerDocument(o => { o.MaxEndpointVersion = 2; o.ShowDeprecatedOps = true; o.DocumentSettings = s => { s.DocumentName = "Release 2"; s.Version = "v2"; }; }); var app = bld.Build(); app .UseFastEndpoints() .UseSwaggerGen(); app.Run(); class MyEndpoint : EndpointWithoutRequest { public override void Configure() { Get("say-hello"); AllowAnonymous(); Version(0, deprecateAt: 1); } public override Task HandleAsync(CancellationToken c) => SendAsync($"hello from version: {Definition.Version.Current}"); } class MyEndpoint_V1 : MyEndpoint { public override void Configure() { base.Configure(); Version(1, deprecateAt: 2); } } class MyEndpoint_V2 : MyEndpoint { public override void Configure() { base.Configure(); Version(2, deprecateAt: 3); } }