VOOZH about

URL: https://www.nuget.org/packages/Swashbuckle.AspNetCore.Community.OData/

⇱ NuGet Gallery | Swashbuckle.AspNetCore.Community.OData 2.0.1




👁 Image
Swashbuckle.AspNetCore.Community.OData 2.0.1

dotnet add package Swashbuckle.AspNetCore.Community.OData --version 2.0.1
 
 
NuGet\Install-Package Swashbuckle.AspNetCore.Community.OData -Version 2.0.1
 
 
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="Swashbuckle.AspNetCore.Community.OData" Version="2.0.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Swashbuckle.AspNetCore.Community.OData" Version="2.0.1" />
 
Directory.Packages.props
<PackageReference Include="Swashbuckle.AspNetCore.Community.OData" />
 
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 Swashbuckle.AspNetCore.Community.OData --version 2.0.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Swashbuckle.AspNetCore.Community.OData, 2.0.1"
 
 
#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 Swashbuckle.AspNetCore.Community.OData@2.0.1
 
 
#: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=Swashbuckle.AspNetCore.Community.OData&version=2.0.1
 
Install as a Cake Addin
#tool nuget:?package=Swashbuckle.AspNetCore.Community.OData&version=2.0.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Swashbuckle.AspNetCore.Community.OData

👁 GitHub Actions Status
👁 Swashbuckle.AspNetCore.Community.OData NuGet Package Downloads

👁 GitHub Actions Build History

The most comprehensive OpenAPI (Swagger) documentation generator for ASP.NET Core OData APIs.

Provides full support for OData query options ($filter, $select, $expand, etc.), real endpoint-based path generation, and seamless Swashbuckle integration.

🎬 Swagger UI Demo

<img src="./Images/swagger-ui-demo.webp" alt="Swagger UI demo" width="800" />

If animation is not shown in your Markdown viewer, open directly.

Start with for the canonical reference and for change history and breaking changes.

AddEnhancedSwaggerGenOData* is the default API path. AddSwaggerGenOData remains only as an obsolete compatibility shim.

✨ Features

  • 🔍 Full OData Query Support - Automatic documentation of $filter, $select, $expand, $orderby, $top, $skip, $count, $search
  • 📡 Real Endpoint-Based Generation - Uses actual ASP.NET Core endpoint routing for accurate API documentation
  • 🎯 Complete OData Path Coverage - Entity sets, singletons, functions, actions, property access, $value, $ref
  • 🚀 HTTP Method Accuracy - Correctly captures GET, POST, PUT, PATCH, DELETE with proper request/response schemas
  • 🔧 Swashbuckle Integration - Native integration with Swashbuckle.AspNetCore for UI and code generation
  • 📊 Method Overloads - Supports multiple actions with same name, different parameters
  • 🎨 Customizable - Configure query option examples, max page sizes, and more

🚀 Quick Start

1. Install Package

dotnet add package Swashbuckle.AspNetCore.Community.OData

2. Configure in Startup.cs

public void ConfigureServices(IServiceCollection services)
{
 // Add OData with query features
 services.AddControllers()
 .AddOData(o => o
 .AddRouteComponents("odata", GetEdmModel())
 .EnableQueryFeatures(100)
 );

 // Add enhanced OData Swagger with query options
 services.AddEnhancedSwaggerGenODataWithQueryOptions(
 odataSetupAction: opt =>
 {
 opt.SwaggerDoc(
 "v1",
 "odata",
 new OpenApiInfo 
 { 
 Title = "My OData API", 
 Version = "v1",
 Description = "Full OData query support with $filter, $select, $expand!"
 }
 );
 },
 queryOptionsSettings: new ODataQueryOptionsSettings
 {
 EnableFilter = true,
 EnableSelect = true,
 EnableExpand = true,
 MaxTop = 100,
 FilterExample = "Name eq 'John' and Age gt 18"
 }
 );

 // Add Swashbuckle services
 services.AddSwaggerGen();
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
 if (env.IsDevelopment())
 {
 app.UseDeveloperExceptionPage();
 }

 app.UseRouting();
 app.UseAuthorization();

 // Enable Swagger
 app.UseSwagger();
 app.UseSwaggerUI(c =>
 {
 c.SwaggerEndpoint("/swagger/v1/swagger.json", "My OData API v1");
 });

 app.UseEndpoints(endpoints =>
 {
 endpoints.MapControllers();
 });
}

private static IEdmModel GetEdmModel()
{
 var builder = new ODataConventionModelBuilder();
 builder.EntitySet<Product>("Products");
 return builder.GetEdmModel();
}

3. Configure in Program.cs (minimal hosting)

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers()
 .AddOData(o => o
 .AddRouteComponents("odata", GetEdmModel())
 .EnableQueryFeatures(100));

builder.Services.AddEnhancedSwaggerGenODataWithQueryOptions(
 odataSetupAction: opt =>
 {
 opt.SwaggerDoc("v1", "odata", new OpenApiInfo
 {
 Title = "My OData API",
 Version = "v1"
 });
 });

builder.Services.AddSwaggerGen();

var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "My OData API v1"));
app.MapControllers();
app.Run();

📖 Upcoming in v2.0 (Unreleased)

Enhanced Features

  • Endpoint-Based Path Generation: Uses actual ASP.NET Core endpoint routing instead of just EDM inference
  • Full Query Options Documentation: Every GET collection endpoint includes $filter, $select, $expand, etc.
  • Complete Path Coverage: Property access (/Products(1)/Name), $value, $ref paths
  • Method Overload Support: Multiple actions with same name are correctly documented
  • Better HTTP Semantics: Accurate methods, status codes, request/response schemas

Track current release status in . See for detailed feature documentation.

📊 Comparison with Other Approaches

Feature Basic EDM OData's Sample Enhanced Swashbuckle
OData Query Options Full support
Real Endpoint Paths + Enhanced
Property Access Paths Added
$value/$ref Paths Added
Method Overloads ⚠️ Full
Swashbuckle Integration Native

📝 Example Output

paths:
 /Products:
 get:
 summary: Get entities from Products
 parameters:
 - name: $filter
 in: query
 description: Filter using OData expressions
 example: "Name eq 'John' and Price gt 100"
 - name: $select
 in: query
 description: Select specific properties
 example: "Name,Price,Category"
 - name: $expand
 in: query
 description: Expand related entities
 example: "Category,Orders"
 - name: $top
 in: query
 schema:
 type: integer
 maximum: 100
 post:
 summary: Create a new Product
 
 /Products({key}):
 get:
 summary: Get Product by key
 put:
 summary: Update Product (full)
 patch:
 summary: Update Product (partial with Delta)
 delete:
 summary: Delete Product
 
 /Products({key})/Category/$ref:
 get:
 summary: Get Category reference
 put:
 summary: Update Category reference
 delete:
 summary: Remove Category reference

🛠️ Advanced Configuration

Multi-Route OData APIs

services.AddEnhancedSwaggerGenODataWithQueryOptions(
 odataSetupAction: opt =>
 {
 opt.SwaggerDoc("v1", "odata", new OpenApiInfo { Title = "Public API", Version = "v1" });
 opt.SwaggerDoc("internal", "internal", new OpenApiInfo { Title = "Internal API", Version = "v1" });
 },
 queryOptionsSettings: new ODataQueryOptionsSettings
 {
 MaxTop = 1000,
 EnableSearch = true,
 FilterExample = "CreatedDate gt 2023-01-01"
 }
);

Combine with Standard Swashbuckle

services.AddEnhancedSwaggerGenOData(opt =>
{
 opt.SwaggerDoc("odata", "odata", new OpenApiInfo { Title = "OData API", Version = "v1" });
});

services.AddSwaggerGen(options =>
{
 options.SwaggerDoc("rest", new OpenApiInfo { Title = "REST API", Version = "v1" });
 options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme { ... });
});

🎯 Use Cases

  • API Documentation: Interactive Swagger UI with full OData query support
  • Code Generation: Client SDK generation from accurate OpenAPI specs
  • Testing: Discover all endpoints including navigation properties
  • Standards Compliance: OData-OpenAPI mapping specification compliance

📚 Documentation

  • - Canonical reference and configuration guide
  • - Feature-focused deep dive
  • - Release and breaking-change history
  • - Maintainer release/build workflow
  • - Maintainer list
  • - Lightweight sample implementation
  • - Validation-focused sample with richer OData surface area
  • OData to OpenAPI Mapping - Official OData OpenAPI specification

🏗️ Building from Source

git clone https://github.com/Tiberriver256/Swashbuckle.AspNetCore.Community.OData.git
cd Swashbuckle.AspNetCore.Community.OData
dotnet restore
dotnet build
dotnet test

🤝 Contributing

Contributions are welcome. Please read our .

For behavior-affecting changes, contributions are expected to include:

  • unit/integration test updates
  • relevant documentation updates (README.md and/or DOCUMENTATION.md)
  • release note entries in RELEASE_NOTES.md when appropriate

📄 License

This project is licensed under the MIT License - see the file for details.

🙏 Acknowledgments

Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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
2.0.1 761 2/8/2026
1.0.0 11,782 8/31/2024
0.0.1 12,726 10/23/2021