Skip to main content

MinimalApis.Discovery by Shawn Wildermuth

Nuget / site data

Nuget GitHub last commit GitHub Repo stars

Details

Info

info

Name: MinimalApis.Discovery

A utility library to allow for structuring Minimal APIs and registering them via source generator.

Author: Shawn Wildermuth

NuGet: https://www.nuget.org/packages/MinimalApis.Discovery/

You can find more details at https://github.com/shawnwildermuth/MinimalApis

Source : https://github.com/shawnwildermuth/MinimalApis

Original Readme

note

Minimal API Tools

This is the home of a set of tools that I've created for Minimal APIs. These include:

About

note

Controller like API registering

How to use

Example ( source csproj, source files )

This is the CSharp Project that references MinimalApis.Discovery

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
<PackageReference Include="MinimalApis.Discovery" Version="1.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>

Generated Files

Those are taken from $(BaseIntermediateOutputPath)\GX

// <auto-generated/>
using System;
using Microsoft.AspNetCore.Builder;

namespace MinimalApis.Discovery
{
public static class MinimalApisDiscoveryGeneratedExtensions
{
public static WebApplication MapApis(this WebApplication app)
{
// Call Register on all classes that implement IApi
new global::APIDemo.PersonAPI().Register(app);
return app;
}
}
}

Usefull

Download Example (.NET C# )

Share MinimalApis.Discovery

https://ignatandrei.github.io/RSCG_Examples/v2/docs/MinimalApis.Discovery

In the same category (API) - 8 other generators

Microsoft.Extensions.Configuration.Binder

MinimalApiBuilder

MinimalHelpers.Routing.Analyzers

RDG

Refit

RSCG_WebAPIExports

SafeRouting

SkinnyControllersCommon