Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implemented comprehensive unit tests for RabbitMqTransportServer, covering constructor, disposal, connection management, event handlers, and exception handling. - Added configuration tests for RabbitMqTransportServer to validate SSL, durable queues, auto-recovery, and custom virtual host options. - Created unit tests for UdpFrameProtocol, including frame parsing and serialization, header size validation, and round-trip data preservation. - Developed tests for UdpTransportClient, focusing on connection handling, event subscriptions, and exception scenarios. - Established tests for UdpTransportServer, ensuring proper start/stop behavior, connection state management, and event handling. - Included tests for UdpTransportOptions to verify default values and modification capabilities. - Enhanced service registration tests for Udp transport services in the dependency injection container.
89 lines
3.3 KiB
C#
89 lines
3.3 KiB
C#
using Microsoft.CodeAnalysis;
|
|
|
|
namespace StellaOps.Microservice.SourceGen;
|
|
|
|
/// <summary>
|
|
/// Diagnostic descriptors for the source generator.
|
|
/// </summary>
|
|
internal static class DiagnosticDescriptors
|
|
{
|
|
private const string Category = "StellaOps.Microservice";
|
|
|
|
/// <summary>
|
|
/// Class with [StellaEndpoint] must implement IStellaEndpoint or IRawStellaEndpoint.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor MissingHandlerInterface = new(
|
|
id: "STELLA001",
|
|
title: "Missing handler interface",
|
|
messageFormat: "Class '{0}' with [StellaEndpoint] must implement IStellaEndpoint<TRequest, TResponse> or IRawStellaEndpoint",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Error,
|
|
isEnabledByDefault: true);
|
|
|
|
/// <summary>
|
|
/// Duplicate endpoint detected.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor DuplicateEndpoint = new(
|
|
id: "STELLA002",
|
|
title: "Duplicate endpoint",
|
|
messageFormat: "Duplicate endpoint: {0} {1} is defined in both '{2}' and '{3}'",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Warning,
|
|
isEnabledByDefault: true);
|
|
|
|
/// <summary>
|
|
/// [StellaEndpoint] on abstract class is ignored.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor AbstractClassIgnored = new(
|
|
id: "STELLA003",
|
|
title: "Abstract class ignored",
|
|
messageFormat: "[StellaEndpoint] on abstract class '{0}' is ignored",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Warning,
|
|
isEnabledByDefault: true);
|
|
|
|
/// <summary>
|
|
/// Informational: endpoints generated.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor EndpointsGenerated = new(
|
|
id: "STELLA004",
|
|
title: "Endpoints generated",
|
|
messageFormat: "Generated {0} endpoint descriptors",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Info,
|
|
isEnabledByDefault: false);
|
|
|
|
/// <summary>
|
|
/// Schema generation failed for a type.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor SchemaGenerationFailed = new(
|
|
id: "STELLA005",
|
|
title: "Schema generation failed",
|
|
messageFormat: "Failed to generate JSON Schema for type '{0}' in endpoint '{1}'",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Warning,
|
|
isEnabledByDefault: true);
|
|
|
|
/// <summary>
|
|
/// [ValidateSchema] applied to non-typed endpoint.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor ValidateSchemaOnRawEndpoint = new(
|
|
id: "STELLA006",
|
|
title: "ValidateSchema on raw endpoint",
|
|
messageFormat: "[ValidateSchema] on class '{0}' is ignored because it implements IRawStellaEndpoint",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Warning,
|
|
isEnabledByDefault: true);
|
|
|
|
/// <summary>
|
|
/// External schema resource not found.
|
|
/// </summary>
|
|
public static readonly DiagnosticDescriptor SchemaResourceNotFound = new(
|
|
id: "STELLA007",
|
|
title: "Schema resource not found",
|
|
messageFormat: "External schema resource '{0}' not found for endpoint '{1}'",
|
|
category: Category,
|
|
defaultSeverity: DiagnosticSeverity.Warning,
|
|
isEnabledByDefault: true);
|
|
}
|