Scalar.AspNetCore 2.1.3

dotnet add package Scalar.AspNetCore --version 2.1.3                
NuGet\Install-Package Scalar.AspNetCore -Version 2.1.3                
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="Scalar.AspNetCore" Version="2.1.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Scalar.AspNetCore --version 2.1.3                
#r "nuget: Scalar.AspNetCore, 2.1.3"                
#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 Scalar.AspNetCore as a Cake Addin
#addin nuget:?package=Scalar.AspNetCore&version=2.1.3

// Install Scalar.AspNetCore as a Cake Tool
#tool nuget:?package=Scalar.AspNetCore&version=2.1.3                

Scalar .NET API Reference Integration

Version Downloads Discord

This .NET package Scalar.AspNetCore provides an easy way to render beautiful API references based on OpenAPI/Swagger documents.

Made possible by the wonderful work of @captainsafia on building the integration and docs written for the Scalar & .NET integration. Thanks to @xC0dex for making it awesome.

Features

  • Stunning API Reference
  • Compatible with .NET 8 and above
  • Independent of OpenAPI document generators
  • Fully AOT (Ahead-of-Time) compatible

dotnet

Migration Guide

If you are upgrading from 1.x.x to 2.x.x, please refer to the migration guide.

Usage

  1. Install the package
dotnet add package Scalar.AspNetCore --version 2.1.*

[!NOTE] We release new versions frequently to bring you the latest features and bug fixes. To reduce the noise in your project file, we recommend using a wildcard for the patch version, e.g., 2.1.*.

  1. Add the using directive
using Scalar.AspNetCore;
  1. Configure your application

Add the following to Program.cs based on your OpenAPI generator:

For Microsoft.AspNetCore.OpenApi:

builder.Services.AddOpenApi();

if (app.Environment.IsDevelopment())
{
    app.MapOpenApi();
    app.MapScalarApiReference();
}

For Swashbuckle:

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

if (app.Environment.IsDevelopment())
{
    app.UseSwagger(options =>
    {
        options.RouteTemplate = "/openapi/{documentName}.json";
    });
    app.MapScalarApiReference();
}

For NSwag:

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddOpenApiDocument();

if (app.Environment.IsDevelopment())
{
    app.UseOpenApi(options =>
    {
        options.Path = "/openapi/{documentName}.json";
    });
    app.MapScalarApiReference();
}

That's it! 🎉 You can now access the Scalar API Reference at /scalar. By default, the API Reference uses the v1 document. You can add documents by calling the AddDocument method. Alternatively, you can navigate to /scalar/{documentName} (e.g., /scalar/v1) to view the API Reference for a specific document. Please check out the dotnet integration documentation for more details.

Configuration

For detailed configuration options, refer to the integration documentation. This documentation focuses on the features provided by the package.

For more realistic examples and advanced usage scenarios, such as authentication, API versioning, and handling multiple documents, check out our extended examples documentation. This documentation is also useful if you need more context on what Scalar.AspNetCore is for.

Development

Local

  1. Download .NET 9.0
  2. Jump to the package folder: cd integrations/aspnetcore
  3. Do a fresh build: dotnet build
  4. Run the tests: dotnet test

And see it in action here:

  1. Switch to the playground: cd playground/Scalar.AspNetCore.Playground
  2. Start the playground: dotnet run
  3. Open this URL in the browser: http://localhost:5056/scalar/

Docker

If you don't have the SDK installed or want to run the playground under a subpath, you can use Docker Compose:

  1. Run Docker Compose: docker compose up --build
  2. Open this URL in the browser: http://localhost:8080/api/scalar/

Community

We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar

License

The source code in this repository is licensed under MIT.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (38)

Showing the top 5 NuGet packages that depend on Scalar.AspNetCore:

Package Downloads
Rystem.Api.Server

Rystem.Api helps you to integrate Api Server and Automated Client for Aspect-Oriented programming.

devprime.stack.web

DevPrime Web

Mii.Rinjani.Gateway.Commons

Package Description

ShayganTadbir.Framework.Core

Package description

Corner49.Infra

An opinionated set of infrastructure libraries for .Net applications

GitHub repositories (32)

Showing the top 5 popular GitHub repositories that depend on Scalar.AspNetCore:

Repository Stars
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
dotnet/eShop
A reference .NET application implementing an eCommerce site
davidfowl/TodoApp
Todo application with ASP.NET Core Blazor WASM, Minimal APIs and Authentication
webprofusion/certify
Professional ACME Client for Windows. Certificate Management UI, powered by Let's Encrypt and compatible with all ACME v2 CAs. Used by over 150,000 organisations. Remember to Star us! Download from certifytheweb.com
grandnode/grandnode2
E-commerce platform built with ASP.NET Core using MongoDB for NoSQL storage
Version Downloads Last updated
2.1.3 1,070 a day ago
2.1.2 5,512 4 days ago
2.1.1 23,861 10 days ago
2.1.0 11,927 11 days ago
2.0.36 31,425 14 days ago
2.0.34 3,822 15 days ago
2.0.33 1,150 16 days ago
2.0.30 14,883 17 days ago
2.0.29 16,846 19 days ago
2.0.28 1,182 20 days ago
2.0.27 5,599 20 days ago
2.0.26 17,319 23 days ago
2.0.25 6,005 23 days ago
2.0.24 8,837 24 days ago
2.0.23 87,342 25 days ago
2.0.22 8,980 a month ago
2.0.21 11,894 a month ago
2.0.20 10,779 a month ago
2.0.19 2,039 a month ago
2.0.18 142,179 a month ago
2.0.17 2,599 a month ago
2.0.16 6,535 a month ago
2.0.15 20,367 a month ago
2.0.14 37,138 2 months ago
2.0.12 70,702 2 months ago
2.0.11 25,983 2 months ago
2.0.10 3,407 2 months ago
2.0.9 41,274 2 months ago
2.0.8 1,718 2 months ago
2.0.7 16,166 2 months ago
2.0.6 1,718 2 months ago
2.0.5 10,428 2 months ago
2.0.4 32,095 2 months ago
2.0.2 23,332 2 months ago
2.0.1 27,169 2 months ago
2.0.0 4,471 2 months ago
1.2.76 56,043 3 months ago
1.2.75 11,559 3 months ago
1.2.74 32,380 3 months ago
1.2.73 6,224 3 months ago
1.2.72 55,817 3 months ago
1.2.71 5,016 3 months ago
1.2.70 6,364 3 months ago
1.2.69 1,531 3 months ago
1.2.68 2,927 3 months ago
1.2.67 767 3 months ago
1.2.66 5,779 3 months ago
1.2.65 731 3 months ago
1.2.64 12,775 3 months ago
1.2.63 6,209 3 months ago
1.2.61 3,524 3 months ago
1.2.60 3,148 3 months ago
1.2.59 583 3 months ago
1.2.58 412 3 months ago
1.2.57 1,326 3 months ago
1.2.56 13,957 3 months ago
1.2.55 5,393 4 months ago
1.2.54 526 4 months ago
1.2.53 11,289 4 months ago
1.2.52 1,123 4 months ago
1.2.51 14,141 4 months ago
1.2.50 6,406 4 months ago
1.2.49 15,115 4 months ago
1.2.48 5,995 4 months ago
1.2.47 6,824 4 months ago
1.2.46 1,207 4 months ago
1.2.45 76,514 4 months ago
1.2.44 29,240 4 months ago
1.2.43 1,376 4 months ago
1.2.42 21,153 4 months ago
1.2.41 31,232 4 months ago
1.2.40 915 4 months ago
1.2.39 15,384 4 months ago
1.2.38 399 4 months ago
1.2.37 11,580 5 months ago
1.2.36 17,841 5 months ago
1.2.35 2,452 5 months ago
1.2.34 17,416 5 months ago
1.2.33 2,673 5 months ago
1.2.32 371 5 months ago
1.2.31 5,533 5 months ago
1.2.30 2,208 5 months ago
1.2.29 5,975 5 months ago
1.2.28 1,060 5 months ago
1.2.27 8,390 5 months ago
1.2.26 4,394 5 months ago
1.2.25 2,917 5 months ago
1.2.24 1,557 5 months ago
1.2.23 5,546 5 months ago
1.2.22 4,434 5 months ago
1.2.21 3,470 5 months ago
1.2.20 713 5 months ago
1.2.19 187 5 months ago
1.2.18 5,923 5 months ago
1.2.17 569 5 months ago
1.2.16 858 5 months ago
1.2.15 609 5 months ago
1.2.14 288 5 months ago
1.2.13 272 5 months ago
1.2.12 982 5 months ago
1.2.11 292 5 months ago
1.2.10 4,408 5 months ago
1.2.9 19,329 6 months ago
1.2.8 564 6 months ago
1.2.7 906 6 months ago
1.2.6 245 6 months ago
1.2.5 1,662 6 months ago
1.2.4 3,672 6 months ago
1.2.3 7,041 7 months ago
1.1.2 12,250 8 months ago
1.1.1 5,411 5/21/2024
1.0.1 660 5/15/2024