MMonrad.OpenApi.Extensions
0.0.27
dotnet add package MMonrad.OpenApi.Extensions --version 0.0.27
NuGet\Install-Package MMonrad.OpenApi.Extensions -Version 0.0.27
<PackageReference Include="MMonrad.OpenApi.Extensions" Version="0.0.27" />
<PackageVersion Include="MMonrad.OpenApi.Extensions" Version="0.0.27" />
<PackageReference Include="MMonrad.OpenApi.Extensions" />
paket add MMonrad.OpenApi.Extensions --version 0.0.27
#r "nuget: MMonrad.OpenApi.Extensions, 0.0.27"
#:package MMonrad.OpenApi.Extensions@0.0.27
#addin nuget:?package=MMonrad.OpenApi.Extensions&version=0.0.27
#tool nuget:?package=MMonrad.OpenApi.Extensions&version=0.0.27
Open Api Extensions
Table of Contents
Elevator Pitch
Simplify your OpenAPI integration with our .NET 9 NuGet packages! OpenApi.Extensions delivers essential, reusable extensions to streamline and enhance your OpenAPI documentation. OpenApi.NodaTime builds on this foundation, adding seamless support for NodaTime, ensuring accurate and user-friendly representations of time-related data in your APIs. Perfect for developers seeking both flexibility and precision in their API solutions.
Example
var collection = new ServiceCollection();
using var services = collection.BuildServiceProvider();
services.AddOpenApi(opt =>
{
opt.OpenApiVersion = OpenApiSpecVersion.OpenApi3_0;
opt.AddDescription("This project contains samples on the extensions library OpenApi.Extensions.");
opt.ConfigureNodaTime();
opt.AddType<CommandRequestId, string>(new CommandRequestId(Guid.Empty));
});
Extensions
NodaTime
Allows to configure Asp.Net Core and OpenApi to use NodaTime types.
Installation
dotnet add package MMonrad.OpenApi.NodaTime
Type mappings
| NodaTime Type | OpenAPI Type | OpenAPI Format | Description | Example |
|---|---|---|---|---|
| Instant | string |
date-time |
Represents an instant in time (UTC) without time zone information. | 2023-12-21T15:30:00Z |
| LocalDateTime | string |
date-time |
A date and time without a time zone. | 2023-12-21T15:30:00 |
| LocalDate | string |
date |
A date without a time component or time zone. | 2023-12-21 |
| LocalTime | string |
time |
A time without a date or time zone. | 15:30:00 |
| OffsetDateTime | string |
date-time |
A date and time with an offset from UTC, but without a specific time zone. | 2023-12-21T15:30:00+01:00 |
| OffsetTime | string |
time |
A time with an offset from UTC, but without a specific date. | 15:30:00+01:00 |
| ZonedDateTime | string |
date-time |
A date and time with a time zone. Often used for scheduling and calendaring. | 2023-12-21T15:30:00+01:00[Europe/London] |
| Period | string |
duration |
An ISO 8601 duration representing an elapsed time. | P1Y2M10DT2H30M |
| Duration | string |
string |
An elapsed time measured in nanoseconds. | 25:01:01.001 |
| Interval | object |
- | Represents a time interval between two Instant values, expressed with start and end. |
{ "start": "2023-12-21T10:00:00Z", "end": "2023-12-21T15:30:00Z" } |
| DateInterval | object |
- | A date interval between two LocalDate values, expressed with start and end. |
{ "start": "2023-12-20", "end": "2023-12-25" } |
Contributing
If you want to contribute to the project and make it better, your help is very welcome.
How to make a clean pull request
- Create a personal fork of the project on Github.
- Create a new branch to work on! Branch from
main. - Implement/fix your feature, comment your code.
- Follow the code style of the project, including indentation.
- Add or change the documentation as needed.
- From your fork open a pull request in the correct branch. Target the project's
mainbranch.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.OpenApi (>= 10.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MMonrad.OpenApi.Extensions:
| Package | Downloads |
|---|---|
|
MMonrad.OpenApi.NodaTime
Extensions for OpenApi |
GitHub repositories
This package is not used by any popular GitHub repositories.