Skip to main content

Oproto.Lambda.OpenApi

NuGet Version NuGet Downloads

The core library providing OpenAPI specification generation for AWS Lambda Annotations .NET applications.

Installation

dotnet add package Oproto.Lambda.OpenApi

Key Features

  • Source Generator - Generates OpenAPI specs at build time with zero runtime overhead
  • Lambda Annotations Support - Works seamlessly with [LambdaFunction], [HttpApi], and [RestApi] attributes
  • AOT Compatible - Full support for Native AOT deployments
  • Security Schemes - Define API Key, OAuth2, Bearer, and OpenID Connect authentication
  • Response Types - Document response types for IHttpResult methods
  • Schema Customization - Rich attribute-based schema customization with validation rules
  • Tag Groups - Organize tags into hierarchical groups for documentation navigation (x-tagGroups)
  • Automatic Examples - Compose examples from property-level schema attributes
  • API Gateway Integration - Automatic x-amazon-apigateway-integration extension

Quick Start

using Amazon.Lambda.Annotations;
using Amazon.Lambda.Annotations.APIGateway;
using Oproto.Lambda.OpenApi.Attributes;

// Assembly-level API info
[assembly: OpenApiInfo("My API", "1.0.0")]

public class Functions
{
[LambdaFunction]
[HttpApi(LambdaHttpMethod.Get, "/products/{id}")]
[OpenApiOperation(Summary = "Get product by ID")]
[OpenApiTag("Products")]
public async Task<Product> GetProduct(string id)
{
// Implementation
}
}

Build your project and an openapi.json file is automatically generated.

Documentation

NuGet

View on NuGet.org