This commit implements a complete rebranding of the project: - Updated all namespaces from `DocumentOperator` to `DocumentService`. - Renamed file paths, embedded resources, and test data references. - Updated configuration keys, logging paths, and Redis instance names. - Revised documentation to reflect the new project name. - Modified project and solution files to align with the new structure. - Updated class names, DTOs, commands, queries, and handlers. - Adjusted middleware, controllers, and API endpoints. - Updated Swagger metadata and API titles to `DocumentService API`. - Refactored test namespaces, resource paths, and embedded resources. - Updated build and deployment configurations for the new name. - Replaced all references to `DocumentOperator` in comments and literals. These changes ensure consistency across the codebase and documentation.
51 lines
2.0 KiB
C#
51 lines
2.0 KiB
C#
using Microsoft.Extensions.Options;
|
|
using Microsoft.OpenApi.Models;
|
|
using System.Reflection;
|
|
|
|
namespace DocumentService.API.Configuration
|
|
{
|
|
/// <summary>
|
|
/// Provides extension methods for configuring Swagger/OpenAPI documentation.
|
|
/// </summary>
|
|
public static class SwaggerConfiguration
|
|
{
|
|
/// <summary>
|
|
/// Adds Swagger documentation generation to the service collection.
|
|
/// </summary>
|
|
/// <param name="services">The service collection to add Swagger to.</param>
|
|
/// <param name="configuration">Configuration to read SwaggerSettings from.</param>
|
|
/// <returns>The modified service collection.</returns>
|
|
public static IServiceCollection AddSwaggerDocumentation(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
var swaggerSettings = configuration.GetSection(SwaggerSettings.SectionName).Get<SwaggerSettings>()
|
|
?? new SwaggerSettings();
|
|
|
|
services.AddSwaggerGen(options =>
|
|
{
|
|
options.SwaggerDoc(swaggerSettings.Version, new OpenApiInfo
|
|
{
|
|
Title = swaggerSettings.Title,
|
|
Version = swaggerSettings.Version,
|
|
Description = swaggerSettings.Description
|
|
});
|
|
|
|
// Resolve conflicting actions: Keep first variant
|
|
// DualInputDocumentFilter will merge both variants into single operation
|
|
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
|
|
|
|
// Add document filter to merge operations with different content types
|
|
options.DocumentFilter<DualInputDocumentFilter>();
|
|
|
|
// XML-Kommentare einbinden
|
|
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
|
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
|
options.IncludeXmlComments(xmlPath);
|
|
});
|
|
|
|
return services;
|
|
}
|
|
}
|
|
}
|