diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryCodes.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryCodes.cs index 54863ad8655..068dd4f7f89 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryCodes.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryCodes.cs @@ -3,7 +3,7 @@ namespace HotChocolate.Fusion.Logging; public static class LogEntryCodes { public const string DisallowedInaccessible = "DISALLOWED_INACCESSIBLE"; - public const string EnumTypesInconsistent = "ENUM_TYPES_INCONSISTENT"; + public const string EnumValuesMismatch = "ENUM_VALUES_MISMATCH"; public const string ExternalArgumentDefaultMismatch = "EXTERNAL_ARGUMENT_DEFAULT_MISMATCH"; public const string ExternalMissingOnBase = "EXTERNAL_MISSING_ON_BASE"; public const string ExternalOnInterface = "EXTERNAL_ON_INTERFACE"; diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryHelper.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryHelper.cs index 4b26f729baf..0cc59d48e9b 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryHelper.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryHelper.cs @@ -100,18 +100,18 @@ public static LogEntry DisallowedInaccessibleDirectiveArgument( schema); } - public static LogEntry EnumTypesInconsistent( + public static LogEntry EnumValuesMismatch( EnumTypeDefinition enumType, string enumValue, SchemaDefinition schema) { return new LogEntry( string.Format( - LogEntryHelper_EnumTypesInconsistent, + LogEntryHelper_EnumValuesMismatch, enumType.Name, schema.Name, enumValue), - LogEntryCodes.EnumTypesInconsistent, + LogEntryCodes.EnumValuesMismatch, LogSeverity.Error, new SchemaCoordinate(enumType.Name), enumType, diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/EnumTypesInconsistentRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/EnumValuesMismatchRule.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/EnumTypesInconsistentRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/EnumValuesMismatchRule.cs index 85944355fa4..d2b4dcdbd16 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/EnumTypesInconsistentRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/EnumValuesMismatchRule.cs @@ -18,10 +18,10 @@ namespace HotChocolate.Fusion.PreMergeValidation.Rules; /// exact match in their values. /// /// -/// +/// /// Specification /// -internal sealed class EnumTypesInconsistentRule : IEventHandler +internal sealed class EnumValuesMismatchRule : IEventHandler { public void Handle(EnumTypeGroupEvent @event, CompositionContext context) { @@ -44,8 +44,7 @@ public void Handle(EnumTypeGroupEvent @event, CompositionContext context) { if (!enumType.Values.ContainsName(enumValue)) { - context.Log.Write( - EnumTypesInconsistent(enumType, enumValue, schema)); + context.Log.Write(EnumValuesMismatch(enumType, enumValue, schema)); } } } diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.Designer.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.Designer.cs index 00cceb28e63..27f24187714 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.Designer.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.Designer.cs @@ -116,9 +116,9 @@ internal static string LogEntryHelper_DisallowedInaccessibleIntrospectionType { /// /// Looks up a localized string similar to The enum type '{0}' in schema '{1}' must define the value '{2}'.. /// - internal static string LogEntryHelper_EnumTypesInconsistent { + internal static string LogEntryHelper_EnumValuesMismatch { get { - return ResourceManager.GetString("LogEntryHelper_EnumTypesInconsistent", resourceCulture); + return ResourceManager.GetString("LogEntryHelper_EnumValuesMismatch", resourceCulture); } } diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx index 6ef656554db..40f1d6e725e 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx @@ -36,7 +36,7 @@ The built-in directive argument '{0}' in schema '{1}' is not accessible. - + The enum type '{0}' in schema '{1}' must define the value '{2}'. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs index 90067fe9f15..694049a3dc8 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs @@ -47,7 +47,7 @@ private CompositionResult MergeSchemaDefinitions(CompositionCo private static readonly List _preMergeValidationRules = [ new DisallowedInaccessibleElementsRule(), - new EnumTypesInconsistentRule(), + new EnumValuesMismatchRule(), new ExternalArgumentDefaultMismatchRule(), new ExternalMissingOnBaseRule(), new ExternalOnInterfaceRule(), diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumTypesInconsistentRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumTypesInconsistentRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs index 0b59e5bc9fa..2be30e48fc3 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumTypesInconsistentRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs @@ -4,9 +4,9 @@ namespace HotChocolate.Composition.PreMergeValidation.Rules; -public sealed class EnumTypesInconsistentRuleTests : CompositionTestBase +public sealed class EnumValuesMismatchRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new EnumTypesInconsistentRule()]); + private readonly PreMergeValidator _preMergeValidator = new([new EnumValuesMismatchRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -36,7 +36,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) // assert Assert.True(result.IsFailure); Assert.Equal(errorMessages, context.Log.Select(e => e.Message).ToArray()); - Assert.True(context.Log.All(e => e.Code == "ENUM_TYPES_INCONSISTENT")); + Assert.True(context.Log.All(e => e.Code == "ENUM_VALUES_MISMATCH")); Assert.True(context.Log.All(e => e.Severity == LogSeverity.Error)); }