Skip to content

codebeltnet/carter

Extensions for Carter API by Codebelt

Extensions for Carter API by Codebelt

Carter CI/CD Pipelinecodecov Quality Gate Status Maintainability Rating Reliability Rating Security Rating OpenSSF Scorecard

An open-source project (MIT license) that targets and complements the Carter API library. It provides a uniform and convenient way of doing API development for all project types in .NET.

Your versatile Carter companion for modern development with .NET 9 and .NET 10.

It is, by heart, free, flexible and built to extend and boost your agile codebelt.

Concept

The Extensions for Carter API by Codebelt is designed to bring clarity, structure, and consistency to Carter projects. It provides a focused extension layer for Carter with configurable response negotiation primitives and endpoint metadata helpers for ASP.NET Core minimal APIs.

Codebelt.Extensions.Carter Negotiator Examples

These are the standalone response negotiator packages that extend the core Codebelt.Extensions.Carter package with specific content negotiation capabilities:

Codebelt.Extensions.Carter.AspNetCore.Newtonsoft.Json

using Carter;
using Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Formatters;
using Codebelt.Extensions.Carter.AspNetCore.Newtonsoft.Json;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddNewtonsoftJsonFormatterOptions();
builder.Services.AddCarter(c => c
    .WithResponseNegotiator<NewtonsoftJsonNegotiator>());

var app = builder.Build();
app.MapCarter();
app.Run();

Codebelt.Extensions.Carter.AspNetCore.Text.Json

using Carter;
using Codebelt.Extensions.Carter.AspNetCore.Text.Json;
using Cuemon.Extensions.AspNetCore.Text.Json;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddMinimalJsonOptions();
builder.Services.AddCarter(c => c
    .WithResponseNegotiator<JsonResponseNegotiator>());

var app = builder.Build();
app.MapCarter();
app.Run();

Codebelt.Extensions.Carter.AspNetCore.Text.Yaml

using Carter;
using Codebelt.Extensions.AspNetCore.Text.Yaml.Formatters;
using Codebelt.Extensions.Carter.AspNetCore.Text.Yaml;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddMinimalYamlOptions();
builder.Services.AddCarter(c => c
    .WithResponseNegotiator<YamlResponseNegotiator>());

var app = builder.Build();
app.MapCarter();
app.Run();

Codebelt.Extensions.Carter.AspNetCore.Xml

using Carter;
using Codebelt.Extensions.Carter.AspNetCore.Xml;
using Cuemon.Extensions.AspNetCore.Xml;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddMinimalXmlOptions();
builder.Services.AddCarter(c => c
    .WithResponseNegotiator<XmlResponseNegotiator>());

var app = builder.Build();
app.MapCarter();
app.Run();

πŸ“š Documentation

Full documentation (generated by DocFx) located here: https://carter.codebelt.net/

πŸ“¦ Standalone Packages

Provides a focused API for BenchmarkDotNet projects.

Package vNext Stable Downloads
Codebelt.Extensions.Carter vNext Stable Downloads
Codebelt.Extensions.Carter.AspNetCore.Newtonsoft.Json vNext Stable Downloads
Codebelt.Extensions.Carter.AspNetCore.Text.Json vNext Stable Downloads
Codebelt.Extensions.Carter.AspNetCore.Text.Yaml vNext Stable Downloads
Codebelt.Extensions.Carter.AspNetCore.Xml vNext Stable Downloads

Contributing to Extensions for Carter API by Codebelt

Contributions are welcome and appreciated.

Feel free to submit issues, feature requests, or pull requests to help improve this library.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This library provides an opinionated and uniform way of extending Minimal APIs with content negotiation using Carter.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors