using Microsoft.CodeAnalysis; namespace StellaOps.Microservice.SourceGen; /// /// Diagnostic descriptors for the source generator. /// internal static class DiagnosticDescriptors { private const string Category = "StellaOps.Microservice"; /// /// Class with [StellaEndpoint] must implement IStellaEndpoint or IRawStellaEndpoint. /// public static readonly DiagnosticDescriptor MissingHandlerInterface = new( id: "STELLA001", title: "Missing handler interface", messageFormat: "Class '{0}' with [StellaEndpoint] must implement IStellaEndpoint or IRawStellaEndpoint", category: Category, defaultSeverity: DiagnosticSeverity.Error, isEnabledByDefault: true); /// /// Duplicate endpoint detected. /// 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); /// /// [StellaEndpoint] on abstract class is ignored. /// 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); /// /// Informational: endpoints generated. /// public static readonly DiagnosticDescriptor EndpointsGenerated = new( id: "STELLA004", title: "Endpoints generated", messageFormat: "Generated {0} endpoint descriptors", category: Category, defaultSeverity: DiagnosticSeverity.Info, isEnabledByDefault: false); /// /// Schema generation failed for a type. /// 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); /// /// [ValidateSchema] applied to non-typed endpoint. /// 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); /// /// External schema resource not found. /// 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); }