Microsoft.Restier.AspNetCore.Swagger
1.1.1-CI-20240706-232326
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.Restier.AspNetCore.Swagger --version 1.1.1-CI-20240706-232326
NuGet\Install-Package Microsoft.Restier.AspNetCore.Swagger -Version 1.1.1-CI-20240706-232326
<PackageReference Include="Microsoft.Restier.AspNetCore.Swagger" Version="1.1.1-CI-20240706-232326" />
paket add Microsoft.Restier.AspNetCore.Swagger --version 1.1.1-CI-20240706-232326
#r "nuget: Microsoft.Restier.AspNetCore.Swagger, 1.1.1-CI-20240706-232326"
// Install Microsoft.Restier.AspNetCore.Swagger as a Cake Addin #addin nuget:?package=Microsoft.Restier.AspNetCore.Swagger&version=1.1.1-CI-20240706-232326&prerelease // Install Microsoft.Restier.AspNetCore.Swagger as a Cake Tool #tool nuget:?package=Microsoft.Restier.AspNetCore.Swagger&version=1.1.1-CI-20240706-232326&prerelease
Microsoft Restier - OData Made Simple
Releases | Documentation | OData v4.01 Documentation
Swagger for Restier ASP.NET Core
This package helps you quickly implement OpenAPI's Swagger.json and Swagger UI in your Restier service in just a few lines of code.
Supported Platforms
Microsoft.Restier.AspNetCore.Swagger 1.1 currently supports the following platforms:
- ASP.NET Core 6.0, 7.0, and 8.0 via Endpoint Routing
Getting Started
Building OpenAPI into your Restier project is easy!
Step 1: Install Microsoft.Restier.AspNetCore.Swagger
- Add the package above to your API project.
- [Optional] Change the version of your Restier packages to
1.*-*
so you always get the latest version.
Step 2: Convert to Endpoint Routing (Part 1)
- Add the new parameter to the end of your
services.AddRestier()
call:
services.AddRestier((builder) =>
{
...
}, true); // <-- @robertmclaws: This parameter adds Endpoint Routing support.
Step 3: Register Swagger Services
- Add the line below immediately after the
services.AddRestier()
call:
services.AddRestierSwagger();
- There is an overload to this method that takes an
Action<OpenApiConvertSettings>
that will let you change the configuration of the generated Swagger definition.
Step 4: Convert to Endpoint Routing & Use Swagger (Part 2)
- Replace your existing
Configure
code with the following (don't forget your customizations):
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRestierBatching();
app.UseRouting();
app.UseAuthorization();
// @robertmclaws: This line is optional but helps with leveraging ClaimsPrincipal.Current for cross-platform business logic.
app.UseClaimsPrincipals();
app.UseEndpoints(endpoints =>
{
endpoints.Select().Expand().Filter().OrderBy().MaxTop(100).Count().SetTimeZoneInfo(TimeZoneInfo.Utc);
endpoints.MapRestier(builder =>
{
builder.MapApiRoute<YOURAPITYPEHERE>("ROUTENAME", "ROUTEPREFIX", true);
});
});
app.UseRestierSwagger(true);
}
- On the last line, the boolean specifies whether or not to use SwaggerUI. If you want to control more of the UI configuration, use
services.Configure<SwaggerUIOptions>();
in yourConfigureServices()
method.
Step 5: Browse Swagger Resources
- Browse to
/swagger/ROUTENAME/swagger.json
to see the generated Swagger definition. - Browse to
/swagger
to see the Swagger UI.
Reporting Security Issues
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter. You can also find these instructions in this repo's SECURITY.md.
Contributors
Special thanks to everyone involved in making Restier the best API development platform for .NET. The following people have made various contributions to this package:
External |
---|
Cengiz Ilerler |
Robert McLaws |
Micah Rairdon |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.OpenApi.OData (>= 1.6.7 && < 2.0.0)
- Microsoft.Restier.AspNetCore (>= 1.1.1-CI-20240706-232326)
- Microsoft.Restier.Core (>= 1.1.1-CI-20240706-232326)
- Swashbuckle.AspNetCore.Swagger (>= 6.6.2 && < 7.0.0)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2 && < 7.0.0)
-
net7.0
- Microsoft.OpenApi.OData (>= 1.6.7 && < 2.0.0)
- Microsoft.Restier.AspNetCore (>= 1.1.1-CI-20240706-232326)
- Microsoft.Restier.Core (>= 1.1.1-CI-20240706-232326)
- Swashbuckle.AspNetCore.Swagger (>= 6.6.2 && < 7.0.0)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2 && < 7.0.0)
-
net8.0
- Microsoft.OpenApi.OData (>= 1.6.7 && < 2.0.0)
- Microsoft.Restier.AspNetCore (>= 1.1.1-CI-20240706-232326)
- Microsoft.Restier.Core (>= 1.1.1-CI-20240706-232326)
- Swashbuckle.AspNetCore.Swagger (>= 6.6.2 && < 7.0.0)
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.6.2 && < 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.0-CI-20241128-062359 | 85 | 11/28/2024 |
1.1.1 | 1,163 | 7/12/2024 |
1.1.1-rc.1.20240710.0 | 44 | 7/10/2024 |
1.1.1-CI-20240706-232326 | 102 | 7/6/2024 |
1.1.0 | 1,036 | 11/28/2023 |
1.1.0-rc.2.20231127.0 | 83 | 11/27/2023 |
1.1.0-rc.2.20231126.1 | 82 | 11/26/2023 |
1.1.0-rc.2.20231126.0 | 74 | 11/26/2023 |
1.1.0-CI-20231125-225528 | 119 | 11/25/2023 |