Artkinx.ScalarAspNetCore.Annotations 1.0.0-preview.17

This is a prerelease version of Artkinx.ScalarAspNetCore.Annotations.
dotnet add package Artkinx.ScalarAspNetCore.Annotations --version 1.0.0-preview.17
                    
NuGet\Install-Package Artkinx.ScalarAspNetCore.Annotations -Version 1.0.0-preview.17
                    
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="Artkinx.ScalarAspNetCore.Annotations" Version="1.0.0-preview.17" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Artkinx.ScalarAspNetCore.Annotations" Version="1.0.0-preview.17" />
                    
Directory.Packages.props
<PackageReference Include="Artkinx.ScalarAspNetCore.Annotations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Artkinx.ScalarAspNetCore.Annotations --version 1.0.0-preview.17
                    
#r "nuget: Artkinx.ScalarAspNetCore.Annotations, 1.0.0-preview.17"
                    
#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.
#:package Artkinx.ScalarAspNetCore.Annotations@1.0.0-preview.17
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Artkinx.ScalarAspNetCore.Annotations&version=1.0.0-preview.17&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Artkinx.ScalarAspNetCore.Annotations&version=1.0.0-preview.17&prerelease
                    
Install as a Cake Tool

Artkinx.ScalarAspNetCore.Annotations

Artkinx.ScalarAspNetCore.Annotations provides declarative attributes for configuring and enhancing Scalar OpenAPI documentation in ASP.NET Core applications. It supports both Swashbuckle and the Native OpenAPI generation built into .NET 9+.

Overview

Scalar offers a beautiful API reference UI. This package lets you enrich your OpenAPI schema with Scalar-specific extensions (x- extensions) directly from your C# code using standard attributes, making it incredibly easy to configure badges, code samples, custom operation details, and more.

Installation

Install the package via NuGet:

dotnet add package Artkinx.ScalarAspNetCore.Annotations

Setup

Depending on the OpenAPI generator you are using, you need to register the annotations in your Program.cs or Startup.cs.

With Swashbuckle

using Artkinx.ScalarAspNetCore.Annotations.Swashbuckle;

builder.Services.AddSwaggerGen(options =>
{
    // Register the Scalar annotations filters
    options.AddScalarAnnotations();
});

With .NET 9+ Native OpenAPI

using Artkinx.ScalarAspNetCore.Annotations.Native;

builder.Services.AddOpenApi(options =>
{
    // Register the Scalar annotations transformers
    options.AddScalarAnnotations();
});

Available Attributes

Here are the attributes provided by this package to enrich your endpoints:

[ScalarOperation]

Enhance an operation with Scalar-specific metadata.

[HttpGet]
[ScalarOperation(
    Summary = "Get it now",
    Description = "For getting it now",
    OperationId = "Getit",
    Tags = ["Gerit"],
    ThemeColor = "#ffff",
    DisplayName = "Getit"
    )]
public IActionResult GetIt() { ... }

[ScalarResponse]

Annotate your API endpoint with specific response information. You can now use the comprehensive ScalarContentType enum to easily specify MIME types.

[HttpGet]
[ScalarResponse(typeof(MyModel), 200, ScalarContentType.Json)]
public IActionResult Get() { ... }

[ScalarBadge]

Add custom badges to your operations in the Scalar UI. You can specify the name, color, and position.

[HttpGet]
[ScalarBadge("Beta", BadgePosition.After, "warning")]
public IActionResult GetBetaData() { ... }

[ScalarCodeSample]

Provide custom code snippets for your endpoints to be displayed in the Scalar UI.

[HttpPost]
[ScalarCodeSample("curl", "curl -X POST ...", "cURL")]
public IActionResult CreateItem() { ... }

[ScalarSchema]

Provide custom schema modifications for specific types.

[ScalarIgnore]

Hide an operation or a property from the generated OpenAPI documentation entirely.

[ScalarStability]

Provide a value that adds a badge for the endpoint (accepted values: Experimental, Stable, Deprecated).

[ScalarOrder]

Enable custom ordering of schema properties in the Scalar UI by specifying a numeric order value.

[ScalarEnum]

Enrich an enum with Scalar-specific metadata.

[ScalarEnum("MyEnum")]
public enum MyEnum
{
    [ScalarEnum("First", "First value")]
    First,
    [ScalarEnum("Second", "Second value")]
    Second
}

Enums

'ScalarStabilityLevel'

A stringly typed enum containing the supported Stability Levels

ScalarContentType

A strongly typed enum containing all standard HTTP content types (e.g., Json, Xml, MultipartFormData, EventStream, etc.). It includes an extension method .ToMimeString() to easily convert the enum values to their raw MIME string representation ("application/json", "text/event-stream", etc.).


By using these declarative attributes, you can significantly enhance the readability, interactivity, and visual organization of your Scalar API documentation.

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.  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. 
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.0.0-preview.17 81 7/20/2026
1.0.0-preview.16 82 7/14/2026
1.0.0-preview.15 77 7/8/2026
1.0.0-preview.14 73 7/3/2026
1.0.0-preview.10 72 6/27/2026
1.0.0-preview.9 92 6/26/2026
1.0.0-preview.8 92 6/26/2026
1.0.0-preview.7 71 6/26/2026