Stardust.Interstellar.Rest.Annotations
5.7.0
dotnet add package Stardust.Interstellar.Rest.Annotations --version 5.7.0
NuGet\Install-Package Stardust.Interstellar.Rest.Annotations -Version 5.7.0
<PackageReference Include="Stardust.Interstellar.Rest.Annotations" Version="5.7.0" />
<PackageVersion Include="Stardust.Interstellar.Rest.Annotations" Version="5.7.0" />
<PackageReference Include="Stardust.Interstellar.Rest.Annotations" />
paket add Stardust.Interstellar.Rest.Annotations --version 5.7.0
#r "nuget: Stardust.Interstellar.Rest.Annotations, 5.7.0"
#:package Stardust.Interstellar.Rest.Annotations@5.7.0
#addin nuget:?package=Stardust.Interstellar.Rest.Annotations&version=5.7.0
#tool nuget:?package=Stardust.Interstellar.Rest.Annotations&version=5.7.0
Stardust.Interstellar.Rest.Annotations
Define once. Generate everywhere.
Core attributes for building contract-first REST APIs in .NET.
What is Stardust.Rest?
Stardust.Rest lets you define your REST API as a C# interface�then automatically generates both client proxies and server controllers. No more handwriting HttpClient boilerplate or scaffolding controllers.
[Api("api/users")]
public interface IUserService
{
[Get("{id}")]
Task<User> GetAsync([InPath] string id);
[Post]
Task<User> CreateAsync([InBody] User user);
}
That's it. Share this interface between your client and server projects. The ecosystem handles the rest.
Ecosystem Packages
| Package | What it does |
|---|---|
| Annotations | Define your API contract ? you are here |
| Client | Generate HTTP clients from interfaces |
| Server | Generate ASP.NET Core controllers from interfaces |
Why use it?
- ?? Contract-first � One interface = perfect client/server alignment
- ? Zero boilerplate � No manual HTTP code or controller scaffolding
- ??? Built-in resilience � Circuit breakers, retries, error handling
- ?? Extensible � Custom auth, headers, serialization, error handlers
Installation
dotnet add package Stardust.Interstellar.Rest.Annotations
Quick Reference
HTTP Verbs
[Get("route")] // GET request
[Post("route")] // POST request
[Put("route")] // PUT request
[Delete("route")] // DELETE request
[Patch("route")] // PATCH request
Parameter Binding
[Get("users/{id}")]
Task<User> GetUserAsync(
[InPath] string id, // URL path segment
[InQuery("page_size")] int pageSize, // Query string (?page_size=10)
[InHeader("X-Api-Key")] string apiKey, // HTTP header
[InBody] UpdateRequest request); // Request body
Route Configuration
[Api("api/v1/products")] // Base route prefix
[Api("api/users", "User Management API")] // With description
Attributes Reference
Verb Attributes
| Attribute | HTTP Method |
|---|---|
[Get] / [Get("path")] |
GET |
[Post] / [Post("path")] |
POST |
[Put] / [Put("path")] |
PUT |
[Delete] / [Delete("path")] |
DELETE |
[Patch] / [Patch("path")] |
PATCH |
[Head] / [Head("path")] |
HEAD |
[Options] / [Options("path")] |
OPTIONS |
Parameter Attributes
| Attribute | Location | Example |
|---|---|---|
[InPath] |
URL path | /users/{id} ? [InPath] string id |
[InQuery] or [InQuery("name")] |
Query string | ?filter=active |
[InHeader] or [InHeader("X-Name")] |
HTTP header | Custom headers |
[InBody] |
Request body | JSON/XML payload |
All parameter attributes support Description for OpenAPI documentation:
[InQuery("q", Description = "Search query text")] string searchQuery
Resilience Attributes
// Circuit breaker - stops calling failing services
[CircuitBreaker(threshold: 5, timeoutInMinutes: 1, resetTimeout: 2)]
// Retry with exponential backoff
[Retry(numberOfRetries: 3, retryInterval: 1000, incremetalWait: true)]
// Rate limiting
[Throttling(maxRequestsPerSecound: 10)]
Circuit Breaker Scopes
[CircuitBreaker(5, 1, 2)] // Shared (default)
[CircuitBreaker(5, 1, 2, CircuitBreakerScope.User)] // Per user
[CircuitBreaker(5, 1, 2, CircuitBreakerScope.Client)] // Per client
[CircuitBreaker(5, 1, 2, CircuitBreakerScope.UserAndClient)] // Multi-tenant
Authorization
[AuthorizeWrapper] // Require authentication
[AuthorizeWrapper(Roles = "Admin")] // Require role
[AuthorizeWrapper(Policy = "CanDelete")] // Require policy
Response Handling
[SuccessStatusCode(HttpStatusCode.Created)] // Return 201 on success
[SuccessStatusCode(HttpStatusCode.NoContent)] // Return 204 on success
API Versioning
[Api("api/users")]
[Version("1.0")]
public interface IUserServiceV1 { }
[Api("api/users")]
[Version("2.0", Deprecated = true)]
public interface IUserServiceV2 { }
OpenAPI Documentation
[Api("api/users")]
[ServiceDescription("User management", Tags = "Users", Summary = "CRUD operations")]
public interface IUserService
{
[Get("{id}", "Get user by ID")]
Task<User> GetAsync([InPath(Description = "Unique user ID")] string id);
}
Endpoint Routing Policies (.NET 6+)
[Api("api/items")]
[EndpointRoutingPolicy("SecurityHeaders")] // Apply to all endpoints
public interface IItemService
{
[Get]
[EndpointRoutingPolicy("Caching")] // Endpoint-specific
Task<List<Item>> GetItemsAsync();
}
Extensibility Interfaces
IAuthenticationHandler
Custom authentication logic:
public class BearerTokenHandler : IAuthenticationHandler
{
public void Apply(HttpRequestMessage req)
{
req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _token);
}
// ... other members
}
IHeaderHandler
Custom header processing:
public class CorrelationIdHandler : IHeaderHandler
{
public void SetHeader(HttpRequestMessage req)
{
req.Headers.Add("X-Correlation-Id", Guid.NewGuid().ToString());
}
// ... other members
}
IErrorHandler
Custom error handling:
public class CustomErrorHandler : IErrorHandler
{
public Exception ProduceClientException(
string message, HttpStatusCode statusCode,
Exception innerException, string body)
{
return new CustomApiException(message, statusCode, body);
}
}
[ErrorHandler(typeof(CustomErrorHandler))]
public interface IApiService { }
IErrorCategorizer
Control retry behavior:
public class CustomErrorCategorizer : IErrorCategorizer
{
public bool IsTransientError(Exception ex) => ex is HttpRequestException { StatusCode: HttpStatusCode.ServiceUnavailable };
}
[Retry(3, 1000, true, ErrorCategorizer = typeof(CustomErrorCategorizer))]
public interface IService { }
Target Frameworks
.NET Standard 2.0 | .NET 6.0 | .NET 7.0 | .NET 8.0
License
Apache-2.0
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1)
- Microsoft.Extensions.Primitives (>= 2.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Stardust.Particles (>= 5.0.2)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Runtime (>= 4.3.0)
-
net6.0
- Microsoft.AspNetCore.Mvc.Versioning (>= 5.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1)
- Microsoft.Extensions.Primitives (>= 2.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Stardust.Particles (>= 5.0.2)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Runtime (>= 4.3.0)
-
net7.0
- Microsoft.AspNetCore.Mvc.Versioning (>= 5.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1)
- Microsoft.Extensions.Primitives (>= 2.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Stardust.Particles (>= 5.0.2)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Runtime (>= 4.3.0)
-
net8.0
- Microsoft.AspNetCore.Mvc.Versioning (>= 5.1.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.1.1)
- Microsoft.Extensions.Primitives (>= 2.0.0)
- Newtonsoft.Json (>= 13.0.1)
- Stardust.Particles (>= 5.0.2)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.ILGeneration (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Runtime (>= 4.3.0)
NuGet packages (14)
Showing the top 5 NuGet packages that depend on Stardust.Interstellar.Rest.Annotations:
| Package | Downloads |
|---|---|
|
Stardust.Interstellar.Rest
Create rest service proxies based on decorated interfaces. |
|
|
Veracity.Services.Api
SDK for accessing Veracity MyServices and Profile api. Veracity MyServices is your access point for engagement of digital interaction with DNV GL. You will find digital services like “Rules and Standards”, digital tools such as our OnDemand hosted service “Secure File Transfer“, our collaboration solution “Meeting Places” (SharePoint) and many other services. Some of the services are open to all users (like “Rules and Standards” and “Secure File Transfer”), while other services require an invitation from a DNV GL employee |
|
|
Stardust.Interstellar.Rest.Service.AspNetCore
Create webapi controllers based on decorated interfaces. For use with aspnetcore on netcore or .net framework |
|
|
Stardust.Interstellar
Stardust servicecontainer implementation of the rest api generator. |
|
|
Stardust.Continuum.Client
Client for the continuum live log stream service |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.7.0 | 263 | 1/6/2026 |
| 5.6.1 | 9,846 | 8/9/2024 |
| 5.6.0 | 3,539 | 3/5/2024 |
| 5.5.1 | 42,120 | 5/23/2022 |
| 5.5.0 | 3,073 | 5/16/2022 |
| 5.5.0-rc1 | 3,317 | 9/6/2021 |
| 5.0.1 | 60,244 | 4/6/2021 |
| 5.0.0 | 24,778 | 2/24/2021 |
| 5.0.0-rc1 | 4,214 | 2/16/2021 |
| 4.2.0 | 14,636 | 2/10/2020 |
| 4.1.1 | 26,458 | 8/20/2019 |
| 4.0.1 | 1,403 | 8/20/2019 |
| 4.0.0 | 9,443 | 8/5/2019 |
| 3.4.8 | 11,016 | 5/14/2019 |
| 3.4.6 | 4,591 | 2/7/2019 |
| 3.4.5 | 8,425 | 12/7/2018 |
| 3.4.3 | 3,353 | 12/3/2018 |
| 3.4.1 | 8,874 | 10/4/2018 |
| 3.4.0 | 3,631 | 10/4/2018 |
| 3.3.1 | 3,402 | 10/2/2018 |
| 3.3.0 | 4,326 | 10/1/2018 |
| 3.2.0 | 4,196 | 9/18/2018 |
| 3.1.0 | 9,245 | 6/26/2018 |
| 3.1.0-pre014 | 2,638 | 6/26/2018 |
| 3.1.0-pre013 | 1,419 | 6/25/2018 |
| 2.0.0.3 | 5,536 | 3/19/2018 |
| 2.0.0.2 | 4,582 | 3/5/2018 |
| 2.0.0.1-pre006 | 2,053 | 3/5/2018 |
| 2.0.0.1-pre005 | 2,303 | 2/23/2018 |
| 2.0.0.1-pre004 | 1,405 | 2/21/2018 |
| 2.0.0.1-pre003 | 1,205 | 2/21/2018 |
| 2.0.0.1-pre002 | 1,657 | 2/20/2018 |
| 2.0.0.1-pre001 | 1,148 | 2/20/2018 |
| 2.0.0.1-pre | 2,283 | 12/15/2017 |
| 2.0.0-pre | 4,170 | 8/29/2017 |
| 1.6.3 | 2,700 | 10/23/2017 |
| 1.6.0 | 10,336 | 3/8/2017 |
| 1.5.4 | 3,484 | 2/22/2017 |
| 1.5.3 | 1,523 | 2/20/2017 |
| 1.5.2 | 1,546 | 2/14/2017 |
| 1.5.0 | 4,958 | 1/24/2017 |
| 1.4.3 | 1,784 | 1/9/2017 |
| 1.4.2 | 1,581 | 12/29/2016 |
| 1.4.1.1 | 1,465 | 12/20/2016 |
| 1.4.1 | 6,925 | 11/30/2016 |
| 1.4.0 | 2,756 | 11/23/2016 |
| 1.3.1 | 13,911 | 8/18/2016 |
| 1.3.0 | 4,247 | 8/18/2016 |
| 1.2.6 | 6,481 | 6/24/2016 |
| 1.2.5 | 1,493 | 6/22/2016 |
| 1.2.4 | 1,457 | 6/22/2016 |
| 1.2.3 | 1,442 | 6/22/2016 |
| 1.2.2 | 1,478 | 6/22/2016 |
| 1.2.1 | 1,469 | 6/22/2016 |
| 1.2.0 | 5,955 | 6/14/2016 |
| 1.1.1 | 1,495 | 6/3/2016 |
| 1.1.0 | 12,210 | 6/2/2016 |
| 1.0.0.1 | 4,809 | 5/31/2016 |
Added Service Description options to Verb attributes