Tagada.Swagger 0.2.0-alpha

This is a prerelease version of Tagada.Swagger.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Tagada.Swagger --version 0.2.0-alpha                
NuGet\Install-Package Tagada.Swagger -Version 0.2.0-alpha                
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="Tagada.Swagger" Version="0.2.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tagada.Swagger --version 0.2.0-alpha                
#r "nuget: Tagada.Swagger, 0.2.0-alpha"                
#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 Tagada.Swagger as a Cake Addin
#addin nuget:?package=Tagada.Swagger&version=0.2.0-alpha&prerelease

// Install Tagada.Swagger as a Cake Tool
#tool nuget:?package=Tagada.Swagger&version=0.2.0-alpha&prerelease                

Tagada

Be careful, this library is not production-ready yet.

Tagada is a lightweight functional framework to create a .NET Core Web API without effort. And of course it tastes good.

For those who dream to make an ASP.NET Core Web API in one line of code

Features

  • Add routes based on HTTP methods GET, POST, PUT, DELETE
  • Add routes based on generic input and output <TQuery>, <TQuery, TResult>, <TCommand>, <TCommand, TResult>
  • Execute code BeforeEach() or BeforeEach<T>()
  • Execute code AfterEach() or AfterEach<T>()
  • Add swagger documentation

Get started

A simple Hello World

public void ConfigureServices(IServiceCollection services)
{
    services.AddRouting();
}

public void Configure(IApplicationBuilder app)
{
    app.Map("/api")
        .Get("/hello", () => "Hello world!")
        .Use();
}

Add Swagger documentation

public void ConfigureServices(IServiceCollection services)
{
    services.AddRouting();

    services.AddSwaggerGen(c =>
    {
        c.GenerateTagadaSwaggerDoc();
    });
}

public void Configure(IApplicationBuilder app)
{
    app.Map("/api")
        .Get("/hello", () => "Hello world!")
        .AddSwagger()
        .Use();
}

CQRS-ready

public void ConfigureServices(IServiceCollection services)
{
    services.AddRouting();
}

public void Configure(IApplicationBuilder app)
{
    app.Map("/api")
        .Get<GetContactsQuery>("/contacts", GetContacts)
        .Get<GetContactByIdQuery>("/contacts/{id}", GetContactById)
        .Post<CreateContactCommand>("/contacts", CreateContact)
        .Use();
}
public class GetContactsQuery { }

public class GetContactByIdQuery
{
    public int Id { get; set; }
}

public class CreateContactCommand
{
    public string Name { get; set; }
}

Storing Events in a single line of code

public void ConfigureServices(IServiceCollection services)
{
    services.AddRouting();
}

public void Configure(IApplicationBuilder app)
{
    app.Map("/api")
        .Get<GetContactsQuery>("/contacts", GetContacts)
        .Get<GetContactByIdQuery>("/contacts/{id}", GetContactById)
        .Post<CreateContactCommand>("/contacts", CreateContact)
        .AfterEach(route => Events.Add(route))
        .Use();
}

Roadmap

Short term

  • Fully featured HTTP methods
  • Fully featured Swagger generation
  • Cache Reflection methods (on TQuery, TCommand and TResult)
  • Benchmark Tagada VS traditional approach

Long term

  • Offer a way to detect API endpoints for frontend developers
  • Add Realtime methods On(), OnConnect(), OnDisconnect() and OnReconnect() (if possible)
  • Add Reactive / Observable methods (if possible)
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.3.1 1,645 5/20/2019
1.3.0 1,407 5/19/2019
1.2.1 1,558 12/26/2018
1.2.0 1,512 11/25/2018
1.1.0 1,554 11/25/2018
1.0.0 1,587 9/25/2018
0.2.0-alpha 998 1/4/2018
0.1.0-alpha 912 12/21/2017