Waystone.Common.Api
2.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Waystone.Common.Api --version 2.0.0
NuGet\Install-Package Waystone.Common.Api -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Waystone.Common.Api" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Waystone.Common.Api --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Waystone.Common.Api, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Waystone.Common.Api as a Cake Addin #addin nuget:?package=Waystone.Common.Api&version=2.0.0 // Install Waystone.Common.Api as a Cake Tool #tool nuget:?package=Waystone.Common.Api&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Waystone.Common.Api
The foundational code required to create .NET 6 Clean Architecture API layer projects for Draekien Industries. It is intended to be used alongside:
Recommended Usage
The below sample code is the recommended usage for this library. If you wish to
configure your own problem details mapping (i.e. you have your own exceptions
that must be mapped to specific status codes), then see the Advanced Usage
section and do not use AcceptDefaults()
.
// program.cs
using Waystone.Common.Api;
// after creating the web application builder
builder.Host.UseSerilog(
(context, configuration) =>
configuration.ReadFrom.Configuration(context.Configuration)
.Enrich.WithCorrelationIdHeader(builder.Configuration)
);
// Accept the default configuration provided by Waystone.Common.Api.
// Currently adds:
// - controllers
// - route naming conventions
// - problem details
// - swagger (nswag)
// - newtonsoft configuration
// - correlation id header options
builder.Services
.AddWaystoneApiBuilder(
builder.Environment,
builder.Configuration,
typeof(Program))
.AcceptDefault(
apiName: "ACME",
apiVersion: "v1",
apiDescription: "An api for ACME");
// After creating the web application with `builder.Build()`
// Currently adds:
// - correlation id header middleware
// - https redirection
// - problem details
// - authorization
// - map controllers
// - serilog request logging
app.UseWaystoneApi()
.AcceptDefaults();
Advanced Usage
// program.cs
using Waystone.Common.Api;
// after creating the web application builder
builder.Host.UseSerilog(
(context, configuration) =>
configuration.ReadFrom.Configuration(context.Configuration)
.Enrich.WithCorrelationIdHeader(builder.Configuration)
);
// Manually configure Waystone.Common.Api
builder.Services
.AddWaystoneApiBuilder(
builder.Environment,
builder.Configuration,
typeof(Program))
.AddControllers()
.AddRoutingConventions()
.AddProblemDetails(options => { /* configure problem details */ })
.AddSwaggerDocumentation(
apiName: "ACME",
apiVersion: "v1",
apiDescription: "An api for ACME")
.BindCorrelationIdHeaderOptions();
// After creating the web application with `builder.Build()`
app.UseWaystoneApi()
.UseCorrelationIdHeaderMiddleware();
app.UseHttpsRedirection();
app.UseProblemDetails();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.UseSerilogRequestLogging();
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 was computed. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Hellang.Middleware.ProblemDetails (>= 6.4.2)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 6.0.6)
- NSwag.AspNetCore (>= 13.16.1)
- Serilog.AspNetCore (>= 5.0.0)
- Serilog.Filters.Expressions (>= 2.1.0)
- Serilog.Sinks.Seq (>= 5.1.1)
- Waystone.Common.Application.Contracts (>= 2.0.0)
- ZymLabs.NSwag.FluentValidation.AspNetCore (>= 0.5.1)
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 |
---|---|---|
2.3.0 | 259 | 3/19/2023 |
2.3.0-alpha.12 | 94 | 3/19/2023 |
2.3.0-alpha.3 | 94 | 3/17/2023 |
2.3.0-alpha.1 | 79 | 3/17/2023 |
2.1.0 | 266 | 2/7/2023 |
2.1.0-alpha.19 | 104 | 2/7/2023 |
2.1.0-alpha.13 | 105 | 11/29/2022 |
2.1.0-alpha.8 | 93 | 11/28/2022 |
2.1.0-alpha.4 | 90 | 11/4/2022 |
2.1.0-alpha.1 | 107 | 6/27/2022 |
2.0.1 | 482 | 6/23/2022 |
2.0.1-alpha.3 | 111 | 6/23/2022 |
2.0.0 | 483 | 6/23/2022 |
2.0.0-alpha.9 | 126 | 6/23/2022 |
1.5.1-alpha.7 | 113 | 6/22/2022 |
1.5.1-alpha.3 | 111 | 6/22/2022 |
1.5.1-alpha.1 | 112 | 6/22/2022 |
1.5.0 | 474 | 6/22/2022 |
1.5.0-alpha.12 | 114 | 6/22/2022 |
1.5.0-alpha.7 | 125 | 6/22/2022 |
1.5.0-alpha.3 | 110 | 6/16/2022 |
1.4.0 | 473 | 6/15/2022 |
1.3.0-alpha.9 | 108 | 6/15/2022 |
1.1.0 | 473 | 6/13/2022 |
1.1.0-alpha.3 | 114 | 6/13/2022 |
1.0.2-alpha.1 | 114 | 6/13/2022 |
1.0.1-alpha0002.6 | 101 | 6/13/2022 |
1.0.1-alpha0002.5 | 102 | 6/13/2022 |
0.6.0-alpha0001.5 | 102 | 6/13/2022 |
0.5.2-alpha0002.3 | 108 | 6/13/2022 |