Artkinx.ScalarAspNetCore.Annotations
1.0.0-preview.17
dotnet add package Artkinx.ScalarAspNetCore.Annotations --version 1.0.0-preview.17
NuGet\Install-Package Artkinx.ScalarAspNetCore.Annotations -Version 1.0.0-preview.17
<PackageReference Include="Artkinx.ScalarAspNetCore.Annotations" Version="1.0.0-preview.17" />
<PackageVersion Include="Artkinx.ScalarAspNetCore.Annotations" Version="1.0.0-preview.17" />
<PackageReference Include="Artkinx.ScalarAspNetCore.Annotations" />
paket add Artkinx.ScalarAspNetCore.Annotations --version 1.0.0-preview.17
#r "nuget: Artkinx.ScalarAspNetCore.Annotations, 1.0.0-preview.17"
#:package Artkinx.ScalarAspNetCore.Annotations@1.0.0-preview.17
#addin nuget:?package=Artkinx.ScalarAspNetCore.Annotations&version=1.0.0-preview.17&prerelease
#tool nuget:?package=Artkinx.ScalarAspNetCore.Annotations&version=1.0.0-preview.17&prerelease
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 | Versions 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. |
-
net10.0
- Microsoft.AspNetCore.OpenApi (>= 10.0.9)
- Microsoft.OpenApi (>= 2.7.6)
- Swashbuckle.AspNetCore.SwaggerGen (>= 10.2.3)
-
net8.0
- Microsoft.AspNetCore.OpenApi (>= 8.0.28)
- Microsoft.OpenApi (>= 1.6.23)
- Swashbuckle.AspNetCore.SwaggerGen (>= 8.1.4)
-
net9.0
- Microsoft.AspNetCore.OpenApi (>= 9.0.16)
- Swashbuckle.AspNetCore.SwaggerGen (>= 9.0.6)
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 |