From 3a21e793a22f204643ad5aaa6414c58717a547a0 Mon Sep 17 00:00:00 2001 From: Glen Date: Mon, 13 Jan 2025 11:34:31 +0200 Subject: [PATCH] [Fusion] Restructure composition (#7927) --- .../Fusion.Composition/Errors/ErrorHelper.cs | 3 + .../PostMergeValidator.cs | 7 +- .../PreMergeValidation/Events.cs | 114 ---- .../PreMergeValidation/PreMergeValidator.cs | 512 ------------------ .../Fusion.Composition/PreMergeValidator.cs | 138 +++++ .../CompositionResources.Designer.cs | 9 + .../Properties/CompositionResources.resx | 3 + .../src/Fusion.Composition/SchemaComposer.cs | 67 ++- .../Fusion.Composition/SourceSchemaMerger.cs | 73 +-- .../SourceSchemaValidation/Events.cs | 110 ++++ .../DisallowedInaccessibleElementsRule.cs | 2 +- .../Rules/ExternalOnInterfaceRule.cs | 2 +- .../Rules/ExternalUnusedRule.cs | 2 +- .../Rules/KeyDirectiveInFieldsArgumentRule.cs | 2 +- .../Rules/KeyFieldsHasArgumentsRule.cs | 2 +- .../Rules/KeyFieldsSelectInvalidTypeRule.cs | 2 +- .../Rules/KeyInvalidFieldsRule.cs | 2 +- .../Rules/KeyInvalidFieldsTypeRule.cs | 2 +- .../Rules/KeyInvalidSyntaxRule.cs | 2 +- .../Rules/LookupReturnsListRule.cs | 2 +- .../Rules/LookupReturnsNonNullableTypeRule.cs | 2 +- .../Rules/OverrideFromSelfRule.cs | 2 +- .../Rules/OverrideOnInterfaceRule.cs | 2 +- .../ProvidesDirectiveInFieldsArgumentRule.cs | 2 +- .../Rules/ProvidesFieldsHasArgumentsRule.cs | 2 +- .../ProvidesFieldsMissingExternalRule.cs | 2 +- .../Rules/ProvidesInvalidFieldsTypeRule.cs | 2 +- .../Rules/ProvidesInvalidSyntaxRule.cs | 2 +- .../Rules/ProvidesOnNonCompositeFieldRule.cs | 2 +- .../Rules/QueryRootTypeInaccessibleRule.cs | 2 +- .../RequireDirectiveInFieldsArgumentRule.cs | 2 +- .../Rules/RequireInvalidFieldsTypeRule.cs | 2 +- .../Rules/RequireInvalidSyntaxRule.cs | 2 +- .../Rules/RootMutationUsedRule.cs | 2 +- .../Rules/RootQueryUsedRule.cs | 2 +- .../Rules/RootSubscriptionUsedRule.cs | 2 +- .../SourceSchemaValidator.cs | 413 +++++++++++++- .../Rules/EnumValuesMismatchRuleTests.cs | 2 +- ...xternalArgumentDefaultMismatchRuleTests.cs | 2 +- .../Rules/ExternalMissingOnBaseRuleTests.cs | 2 +- .../FieldArgumentTypesMergeableRuleTests.cs | 2 +- .../InputFieldDefaultMismatchRuleTests.cs | 2 +- .../InputFieldTypesMergeableRuleTests.cs | 2 +- ...InputWithMissingRequiredFieldsRuleTests.cs | 2 +- .../OutputFieldTypesMergeableRuleTests.cs | 2 +- ...DisallowedInaccessibleElementsRuleTests.cs | 12 +- .../Rules/ExternalOnInterfaceRuleTests.cs | 12 +- .../Rules/ExternalUnusedRuleTests.cs | 12 +- .../KeyDirectiveInFieldsArgumentRuleTests.cs | 12 +- .../Rules/KeyFieldsHasArgumentsRuleTests.cs | 13 +- .../KeyFieldsSelectInvalidTypeRuleTests.cs | 12 +- .../Rules/KeyInvalidFieldsRuleTests.cs | 13 +- .../Rules/KeyInvalidFieldsTypeRuleTests.cs | 13 +- .../Rules/KeyInvalidSyntaxRuleTests.cs | 13 +- .../Rules/LookupReturnsListRuleTests.cs | 13 +- .../LookupReturnsNonNullableTypeRuleTests.cs | 12 +- .../Rules/OverrideFromSelfRuleTests.cs | 13 +- .../Rules/OverrideOnInterfaceRuleTests.cs | 13 +- ...videsDirectiveInFieldsArgumentRuleTests.cs | 12 +- .../ProvidesFieldsHasArgumentsRuleTests.cs | 12 +- .../ProvidesFieldsMissingExternalRuleTests.cs | 12 +- .../ProvidesInvalidFieldsTypeRuleTests.cs | 12 +- .../Rules/ProvidesInvalidSyntaxRuleTests.cs | 13 +- .../ProvidesOnNonCompositeFieldRuleTests.cs | 12 +- .../QueryRootTypeInaccessibleRuleTests.cs | 12 +- ...quireDirectiveInFieldsArgumentRuleTests.cs | 12 +- .../RequireInvalidFieldsTypeRuleTests.cs | 12 +- .../Rules/RequireInvalidSyntaxRuleTests.cs | 13 +- .../Rules/RootMutationUsedRuleTests.cs | 13 +- .../Rules/RootQueryUsedRuleTests.cs | 12 +- .../Rules/RootSubscriptionUsedRuleTests.cs | 13 +- 71 files changed, 945 insertions(+), 895 deletions(-) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PostMergeValidation => }/PostMergeValidator.cs (51%) delete mode 100644 src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/PreMergeValidator.cs create mode 100644 src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidator.cs create mode 100644 src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Events.cs rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/DisallowedInaccessibleElementsRule.cs (98%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ExternalOnInterfaceRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ExternalUnusedRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyDirectiveInFieldsArgumentRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyFieldsHasArgumentsRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyFieldsSelectInvalidTypeRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyInvalidFieldsRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyInvalidFieldsTypeRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyInvalidSyntaxRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/LookupReturnsListRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/LookupReturnsNonNullableTypeRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/OverrideFromSelfRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/OverrideOnInterfaceRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesDirectiveInFieldsArgumentRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesFieldsHasArgumentsRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesFieldsMissingExternalRule.cs (96%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesInvalidFieldsTypeRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesInvalidSyntaxRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesOnNonCompositeFieldRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/QueryRootTypeInaccessibleRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/RequireDirectiveInFieldsArgumentRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/RequireInvalidFieldsTypeRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/RequireInvalidSyntaxRule.cs (94%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/RootMutationUsedRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/RootQueryUsedRule.cs (95%) rename src/HotChocolate/Fusion-vnext/src/Fusion.Composition/{PreMergeValidation => SourceSchemaValidation}/Rules/RootSubscriptionUsedRule.cs (96%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/DisallowedInaccessibleElementsRuleTests.cs (92%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ExternalOnInterfaceRuleTests.cs (88%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ExternalUnusedRuleTests.cs (90%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs (92%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyFieldsHasArgumentsRuleTests.cs (90%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs (95%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyInvalidFieldsRuleTests.cs (92%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyInvalidFieldsTypeRuleTests.cs (88%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/KeyInvalidSyntaxRuleTests.cs (86%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/LookupReturnsListRuleTests.cs (88%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/LookupReturnsNonNullableTypeRuleTests.cs (87%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/OverrideFromSelfRuleTests.cs (87%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/OverrideOnInterfaceRuleTests.cs (87%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs (93%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesFieldsHasArgumentsRuleTests.cs (91%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesFieldsMissingExternalRuleTests.cs (91%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesInvalidFieldsTypeRuleTests.cs (89%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesInvalidSyntaxRuleTests.cs (86%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/ProvidesOnNonCompositeFieldRuleTests.cs (91%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/QueryRootTypeInaccessibleRuleTests.cs (88%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs (93%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/RequireInvalidFieldsTypeRuleTests.cs (88%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/RequireInvalidSyntaxRuleTests.cs (86%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/RootMutationUsedRuleTests.cs (87%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/RootQueryUsedRuleTests.cs (87%) rename src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/{PreMergeValidation => SourceSchemaValidation}/Rules/RootSubscriptionUsedRuleTests.cs (87%) diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Errors/ErrorHelper.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Errors/ErrorHelper.cs index 800b1db42f9..119cac22fea 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Errors/ErrorHelper.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Errors/ErrorHelper.cs @@ -4,6 +4,9 @@ namespace HotChocolate.Fusion.Errors; internal static class ErrorHelper { + public static CompositionError SourceSchemaValidationFailed() + => new(ErrorHelper_SourceSchemaValidationFailed); + public static CompositionError PreMergeValidationFailed() => new(ErrorHelper_PreMergeValidationFailed); } diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PostMergeValidation/PostMergeValidator.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PostMergeValidator.cs similarity index 51% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PostMergeValidation/PostMergeValidator.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PostMergeValidator.cs index fb5234a33b3..7bcdcd0ff02 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PostMergeValidation/PostMergeValidator.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PostMergeValidator.cs @@ -1,10 +1,13 @@ +using System.Collections.Immutable; using HotChocolate.Fusion.Results; using HotChocolate.Skimmed; -namespace HotChocolate.Fusion.PostMergeValidation; +namespace HotChocolate.Fusion; -internal sealed class PostMergeValidator +internal sealed class PostMergeValidator(IEnumerable rules) { + private readonly ImmutableArray _rules = [.. rules]; + public CompositionResult Validate(SchemaDefinition _) { // FIXME: Implement. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Events.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Events.cs index da16f7533ac..d68ef528dda 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Events.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Events.cs @@ -1,34 +1,13 @@ using System.Collections.Immutable; using HotChocolate.Fusion.Events; using HotChocolate.Fusion.PreMergeValidation.Info; -using HotChocolate.Language; -using HotChocolate.Skimmed; namespace HotChocolate.Fusion.PreMergeValidation; -internal record DirectiveArgumentEvent( - InputFieldDefinition Argument, - DirectiveDefinition Directive, - SchemaDefinition Schema) : IEvent; - -internal record DirectiveEvent( - DirectiveDefinition Directive, - SchemaDefinition Schema) : IEvent; - -internal record EnumTypeEvent( - EnumTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - internal record EnumTypeGroupEvent( string TypeName, ImmutableArray TypeGroup) : IEvent; -internal record FieldArgumentEvent( - InputFieldDefinition Argument, - OutputFieldDefinition Field, - INamedTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - internal record FieldArgumentGroupEvent( string ArgumentName, ImmutableArray ArgumentGroup, @@ -44,104 +23,11 @@ internal record InputTypeGroupEvent( string InputTypeName, ImmutableArray InputTypeGroup) : IEvent; -internal record KeyFieldEvent( - Directive KeyDirective, - ComplexTypeDefinition EntityType, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record KeyFieldNodeEvent( - FieldNode FieldNode, - ImmutableArray FieldNamePath, - Directive KeyDirective, - ComplexTypeDefinition EntityType, - SchemaDefinition Schema) : IEvent; - -internal record KeyFieldsInvalidReferenceEvent( - FieldNode FieldNode, - ComplexTypeDefinition Type, - Directive KeyDirective, - ComplexTypeDefinition EntityType, - SchemaDefinition Schema) : IEvent; - -internal record KeyFieldsInvalidSyntaxEvent( - Directive KeyDirective, - ComplexTypeDefinition EntityType, - SchemaDefinition Schema) : IEvent; - -internal record KeyFieldsInvalidTypeEvent( - Directive KeyDirective, - ComplexTypeDefinition EntityType, - SchemaDefinition Schema) : IEvent; - -internal record OutputFieldEvent( - OutputFieldDefinition Field, - INamedTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - internal record OutputFieldGroupEvent( string FieldName, ImmutableArray FieldGroup, string TypeName) : IEvent; -internal record ProvidesFieldEvent( - OutputFieldDefinition ProvidedField, - ComplexTypeDefinition ProvidedType, - Directive ProvidesDirective, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record ProvidesFieldNodeEvent( - FieldNode FieldNode, - ImmutableArray FieldNamePath, - Directive ProvidesDirective, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record ProvidesFieldsInvalidSyntaxEvent( - Directive ProvidesDirective, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record ProvidesFieldsInvalidTypeEvent( - Directive ProvidesDirective, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record RequireFieldNodeEvent( - FieldNode FieldNode, - ImmutableArray FieldNamePath, - Directive RequireDirective, - InputFieldDefinition Argument, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record RequireFieldsInvalidSyntaxEvent( - Directive RequireDirective, - InputFieldDefinition Argument, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record RequireFieldsInvalidTypeEvent( - Directive RequireDirective, - InputFieldDefinition Argument, - OutputFieldDefinition Field, - ComplexTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - -internal record SchemaEvent(SchemaDefinition Schema) : IEvent; - -internal record TypeEvent( - INamedTypeDefinition Type, - SchemaDefinition Schema) : IEvent; - internal record TypeGroupEvent( string TypeName, ImmutableArray TypeGroup) : IEvent; diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/PreMergeValidator.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/PreMergeValidator.cs deleted file mode 100644 index 2150f6dd118..00000000000 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/PreMergeValidator.cs +++ /dev/null @@ -1,512 +0,0 @@ -using System.Collections.Immutable; -using HotChocolate.Fusion.Collections; -using HotChocolate.Fusion.Errors; -using HotChocolate.Fusion.Events; -using HotChocolate.Fusion.PreMergeValidation.Info; -using HotChocolate.Fusion.Results; -using HotChocolate.Language; -using HotChocolate.Skimmed; -using static HotChocolate.Language.Utf8GraphQLParser; - -namespace HotChocolate.Fusion.PreMergeValidation; - -internal sealed class PreMergeValidator(IEnumerable rules) -{ - private readonly ImmutableArray _rules = [.. rules]; - - public CompositionResult Validate(CompositionContext context) - { - PublishEvents(context); - - return context.Log.HasErrors - ? ErrorHelper.PreMergeValidationFailed() - : CompositionResult.Success(); - } - - private void PublishEvents(CompositionContext context) - { - MultiValueDictionary typeGroupByName = []; - - foreach (var schema in context.SchemaDefinitions) - { - PublishEvent(new SchemaEvent(schema), context); - - foreach (var type in schema.Types) - { - PublishEvent(new TypeEvent(type, schema), context); - - typeGroupByName.Add(type.Name, new TypeInfo(type, schema)); - - if (type is ComplexTypeDefinition complexType) - { - if (complexType.Directives.ContainsName(WellKnownDirectiveNames.Key)) - { - PublishEntityEvents(complexType, schema, context); - } - - foreach (var field in complexType.Fields) - { - PublishEvent(new OutputFieldEvent(field, type, schema), context); - - if (field.Directives.ContainsName(WellKnownDirectiveNames.Provides)) - { - PublishProvidesEvents(field, complexType, schema, context); - } - - foreach (var argument in field.Arguments) - { - PublishEvent( - new FieldArgumentEvent(argument, field, type, schema), context); - - if (argument.Directives.ContainsName(WellKnownDirectiveNames.Require)) - { - PublishRequireEvents(argument, field, complexType, schema, context); - } - } - } - } - else if (type is EnumTypeDefinition enumType) - { - PublishEvent(new EnumTypeEvent(enumType, schema), context); - } - } - - foreach (var directive in schema.DirectiveDefinitions) - { - PublishEvent(new DirectiveEvent(directive, schema), context); - - foreach (var argument in directive.Arguments) - { - PublishEvent(new DirectiveArgumentEvent(argument, directive, schema), context); - } - } - } - - foreach (var (typeName, typeGroup) in typeGroupByName) - { - PublishEvent(new TypeGroupEvent(typeName, [.. typeGroup]), context); - - MultiValueDictionary inputTypeGroupByName = []; - MultiValueDictionary inputFieldGroupByName = []; - MultiValueDictionary outputFieldGroupByName = []; - MultiValueDictionary enumTypeGroupByName = []; - - foreach (var (type, schema) in typeGroup) - { - switch (type) - { - case InputObjectTypeDefinition inputType: - inputTypeGroupByName.Add( - inputType.Name, - new InputTypeInfo(inputType, schema)); - - foreach (var field in inputType.Fields) - { - inputFieldGroupByName.Add( - field.Name, - new InputFieldInfo(field, type, schema)); - } - - break; - - case ComplexTypeDefinition complexType: - foreach (var field in complexType.Fields) - { - outputFieldGroupByName.Add( - field.Name, - new OutputFieldInfo(field, type, schema)); - } - - break; - - case EnumTypeDefinition enumType: - enumTypeGroupByName.Add(enumType.Name, new EnumTypeInfo(enumType, schema)); - break; - } - } - - foreach (var (inputTypeName, inputTypeGroup) in inputTypeGroupByName) - { - PublishEvent(new InputTypeGroupEvent(inputTypeName, [.. inputTypeGroup]), context); - } - - foreach (var (fieldName, fieldGroup) in inputFieldGroupByName) - { - PublishEvent( - new InputFieldGroupEvent(fieldName, [.. fieldGroup], typeName), context); - } - - foreach (var (fieldName, fieldGroup) in outputFieldGroupByName) - { - PublishEvent( - new OutputFieldGroupEvent(fieldName, [.. fieldGroup], typeName), context); - - MultiValueDictionary argumentGroupByName = []; - - foreach (var (field, type, schema) in fieldGroup) - { - foreach (var argument in field.Arguments) - { - argumentGroupByName.Add( - argument.Name, - new FieldArgumentInfo(argument, field, type, schema)); - } - } - - foreach (var (argumentName, argumentGroup) in argumentGroupByName) - { - PublishEvent( - new FieldArgumentGroupEvent( - argumentName, - [.. argumentGroup], - fieldName, - typeName), - context); - } - } - - foreach (var (enumName, enumGroup) in enumTypeGroupByName) - { - PublishEvent(new EnumTypeGroupEvent(enumName, [.. enumGroup]), context); - } - } - } - - private void PublishEntityEvents( - ComplexTypeDefinition entityType, - SchemaDefinition schema, - CompositionContext context) - { - var keyDirectives = - entityType.Directives - .Where(d => d.Name == WellKnownDirectiveNames.Key) - .ToArray(); - - foreach (var keyDirective in keyDirectives) - { - if (!keyDirective.Arguments.TryGetValue(WellKnownArgumentNames.Fields, out var f) - || f is not StringValueNode fields) - { - PublishEvent( - new KeyFieldsInvalidTypeEvent(keyDirective, entityType, schema), - context); - - continue; - } - - try - { - var selectionSet = Syntax.ParseSelectionSet($"{{{fields.Value}}}"); - - PublishKeyFieldEvents( - selectionSet, - entityType, - keyDirective, - [], - entityType, - schema, - context); - } - catch (SyntaxException) - { - PublishEvent( - new KeyFieldsInvalidSyntaxEvent(keyDirective, entityType, schema), - context); - } - } - } - - private void PublishKeyFieldEvents( - SelectionSetNode selectionSet, - ComplexTypeDefinition entityType, - Directive keyDirective, - List fieldNamePath, - ComplexTypeDefinition? parentType, - SchemaDefinition schema, - CompositionContext context) - { - ComplexTypeDefinition? nextParentType = null; - - foreach (var selection in selectionSet.Selections) - { - if (selection is FieldNode fieldNode) - { - fieldNamePath.Add(fieldNode.Name.Value); - - PublishEvent( - new KeyFieldNodeEvent( - fieldNode, - [.. fieldNamePath], - keyDirective, - entityType, - schema), - context); - - if (parentType is not null) - { - if (parentType.Fields.TryGetField(fieldNode.Name.Value, out var field)) - { - PublishEvent( - new KeyFieldEvent( - keyDirective, - entityType, - field, - parentType, - schema), - context); - - if (field.Type.NullableType() is ComplexTypeDefinition fieldType) - { - nextParentType = fieldType; - } - } - else - { - PublishEvent( - new KeyFieldsInvalidReferenceEvent( - fieldNode, - parentType, - keyDirective, - entityType, - schema), - context); - - nextParentType = null; - } - } - - if (fieldNode.SelectionSet is not null) - { - PublishKeyFieldEvents( - fieldNode.SelectionSet, - entityType, - keyDirective, - fieldNamePath, - nextParentType, - schema, - context); - } - - fieldNamePath = []; - } - } - } - - private void PublishProvidesEvents( - OutputFieldDefinition field, - ComplexTypeDefinition type, - SchemaDefinition schema, - CompositionContext context) - { - var providesDirective = - field.Directives.First(d => d.Name == WellKnownDirectiveNames.Provides); - - if (!providesDirective.Arguments.TryGetValue(WellKnownArgumentNames.Fields, out var f) - || f is not StringValueNode fields) - { - PublishEvent( - new ProvidesFieldsInvalidTypeEvent(providesDirective, field, type, schema), - context); - - return; - } - - try - { - var selectionSet = Syntax.ParseSelectionSet($"{{{fields.Value}}}"); - - PublishProvidesFieldEvents( - selectionSet, - field, - type, - providesDirective, - [], - field.Type, - schema, - context); - } - catch (SyntaxException) - { - PublishEvent( - new ProvidesFieldsInvalidSyntaxEvent(providesDirective, field, type, schema), - context); - } - } - - private void PublishProvidesFieldEvents( - SelectionSetNode selectionSet, - OutputFieldDefinition field, - ComplexTypeDefinition type, - Directive providesDirective, - List fieldNamePath, - ITypeDefinition? parentType, - SchemaDefinition schema, - CompositionContext context) - { - ComplexTypeDefinition? nextParentType = null; - - foreach (var selection in selectionSet.Selections) - { - if (selection is FieldNode fieldNode) - { - fieldNamePath.Add(fieldNode.Name.Value); - - PublishEvent( - new ProvidesFieldNodeEvent( - fieldNode, - [.. fieldNamePath], - providesDirective, - field, - type, - schema), - context); - - if (parentType?.NullableType() is ComplexTypeDefinition providedType) - { - if (providedType.Fields.TryGetField( - fieldNode.Name.Value, - out var providedField)) - { - PublishEvent( - new ProvidesFieldEvent( - providedField, - providedType, - providesDirective, - field, - type, - schema), - context); - - if (providedField.Type.NullableType() is ComplexTypeDefinition fieldType) - { - nextParentType = fieldType; - } - } - else - { - nextParentType = null; - } - } - - if (fieldNode.SelectionSet is not null) - { - PublishProvidesFieldEvents( - fieldNode.SelectionSet, - field, - type, - providesDirective, - fieldNamePath, - nextParentType, - schema, - context); - } - - fieldNamePath = []; - } - } - } - - private void PublishRequireEvents( - InputFieldDefinition argument, - OutputFieldDefinition field, - ComplexTypeDefinition type, - SchemaDefinition schema, - CompositionContext context) - { - var requireDirective = - argument.Directives.First(d => d.Name == WellKnownDirectiveNames.Require); - - if (!requireDirective.Arguments.TryGetValue(WellKnownArgumentNames.Fields, out var f) - || f is not StringValueNode fields) - { - PublishEvent( - new RequireFieldsInvalidTypeEvent(requireDirective, argument, field, type, schema), - context); - - return; - } - - try - { - var selectionSet = Syntax.ParseSelectionSet($"{{{fields.Value}}}"); - - PublishRequireFieldEvents( - selectionSet, - argument, - field, - type, - requireDirective, - [], - schema, - context); - } - catch (SyntaxException) - { - PublishEvent( - new RequireFieldsInvalidSyntaxEvent( - requireDirective, - argument, - field, - type, - schema), - context); - } - } - - private void PublishRequireFieldEvents( - SelectionSetNode selectionSet, - InputFieldDefinition argument, - OutputFieldDefinition field, - ComplexTypeDefinition type, - Directive requireDirective, - List fieldNamePath, - SchemaDefinition schema, - CompositionContext context) - { - foreach (var selection in selectionSet.Selections) - { - if (selection is FieldNode fieldNode) - { - fieldNamePath.Add(fieldNode.Name.Value); - - PublishEvent( - new RequireFieldNodeEvent( - fieldNode, - [.. fieldNamePath], - requireDirective, - argument, - field, - type, - schema), - context); - - if (fieldNode.SelectionSet is not null) - { - PublishRequireFieldEvents( - fieldNode.SelectionSet, - argument, - field, - type, - requireDirective, - fieldNamePath, - schema, - context); - } - - fieldNamePath = []; - } - } - } - - private void PublishEvent(TEvent @event, CompositionContext context) - where TEvent : IEvent - { - foreach (var rule in _rules) - { - if (rule is IEventHandler handler) - { - handler.Handle(@event, context); - } - } - } -} diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidator.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidator.cs new file mode 100644 index 00000000000..0bbe778bdea --- /dev/null +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidator.cs @@ -0,0 +1,138 @@ +using System.Collections.Immutable; +using HotChocolate.Fusion.Collections; +using HotChocolate.Fusion.Errors; +using HotChocolate.Fusion.Events; +using HotChocolate.Fusion.PreMergeValidation; +using HotChocolate.Fusion.PreMergeValidation.Info; +using HotChocolate.Fusion.Results; +using HotChocolate.Skimmed; + +namespace HotChocolate.Fusion; + +internal sealed class PreMergeValidator(IEnumerable rules) +{ + private readonly ImmutableArray _rules = [.. rules]; + + public CompositionResult Validate(CompositionContext context) + { + PublishEvents(context); + + return context.Log.HasErrors + ? ErrorHelper.PreMergeValidationFailed() + : CompositionResult.Success(); + } + + private void PublishEvents(CompositionContext context) + { + MultiValueDictionary typeGroupByName = []; + + foreach (var schema in context.SchemaDefinitions) + { + foreach (var type in schema.Types) + { + typeGroupByName.Add(type.Name, new TypeInfo(type, schema)); + } + } + + foreach (var (typeName, typeGroup) in typeGroupByName) + { + PublishEvent(new TypeGroupEvent(typeName, [.. typeGroup]), context); + + MultiValueDictionary inputTypeGroupByName = []; + MultiValueDictionary inputFieldGroupByName = []; + MultiValueDictionary outputFieldGroupByName = []; + MultiValueDictionary enumTypeGroupByName = []; + + foreach (var (type, schema) in typeGroup) + { + switch (type) + { + case InputObjectTypeDefinition inputType: + inputTypeGroupByName.Add( + inputType.Name, + new InputTypeInfo(inputType, schema)); + + foreach (var field in inputType.Fields) + { + inputFieldGroupByName.Add( + field.Name, + new InputFieldInfo(field, type, schema)); + } + + break; + + case ComplexTypeDefinition complexType: + foreach (var field in complexType.Fields) + { + outputFieldGroupByName.Add( + field.Name, + new OutputFieldInfo(field, type, schema)); + } + + break; + + case EnumTypeDefinition enumType: + enumTypeGroupByName.Add(enumType.Name, new EnumTypeInfo(enumType, schema)); + break; + } + } + + foreach (var (inputTypeName, inputTypeGroup) in inputTypeGroupByName) + { + PublishEvent(new InputTypeGroupEvent(inputTypeName, [.. inputTypeGroup]), context); + } + + foreach (var (fieldName, fieldGroup) in inputFieldGroupByName) + { + PublishEvent( + new InputFieldGroupEvent(fieldName, [.. fieldGroup], typeName), context); + } + + foreach (var (fieldName, fieldGroup) in outputFieldGroupByName) + { + PublishEvent( + new OutputFieldGroupEvent(fieldName, [.. fieldGroup], typeName), context); + + MultiValueDictionary argumentGroupByName = []; + + foreach (var (field, type, schema) in fieldGroup) + { + foreach (var argument in field.Arguments) + { + argumentGroupByName.Add( + argument.Name, + new FieldArgumentInfo(argument, field, type, schema)); + } + } + + foreach (var (argumentName, argumentGroup) in argumentGroupByName) + { + PublishEvent( + new FieldArgumentGroupEvent( + argumentName, + [.. argumentGroup], + fieldName, + typeName), + context); + } + } + + foreach (var (enumName, enumGroup) in enumTypeGroupByName) + { + PublishEvent(new EnumTypeGroupEvent(enumName, [.. enumGroup]), context); + } + } + } + + private void PublishEvent(TEvent @event, CompositionContext context) + where TEvent : IEvent + { + foreach (var rule in _rules) + { + if (rule is IEventHandler handler) + { + handler.Handle(@event, context); + } + } + } +} 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 75ac0ee8cee..084c2306720 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 @@ -68,6 +68,15 @@ internal static string ErrorHelper_PreMergeValidationFailed { } } + /// + /// Looks up a localized string similar to Source schema validation failed. View the composition log for details.. + /// + internal static string ErrorHelper_SourceSchemaValidationFailed { + get { + return ResourceManager.GetString("ErrorHelper_SourceSchemaValidationFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to The built-in scalar type '{0}' in schema '{1}' is not accessible.. /// 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 7daa39801a7..466f8993b24 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx @@ -21,6 +21,9 @@ Pre-merge validation failed. View the composition log for details. + + Source schema validation failed. View the composition log for details. + The built-in scalar type '{0}' in schema '{1}' is not accessible. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SchemaComposer.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SchemaComposer.cs index e4525fba52c..9882c1084e9 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SchemaComposer.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SchemaComposer.cs @@ -1,5 +1,7 @@ using HotChocolate.Fusion.Logging.Contracts; +using HotChocolate.Fusion.PreMergeValidation.Rules; using HotChocolate.Fusion.Results; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; using HotChocolate.Skimmed; namespace HotChocolate.Fusion; @@ -16,13 +18,23 @@ public CompositionResult Compose( var context = new CompositionContext([.. schemaDefinitions], compositionLog); // Validate Source Schemas - var validationResult = new SourceSchemaValidator().Validate(context); + var validationResult = + new SourceSchemaValidator(_sourceSchemaValidationRules).Validate(context); if (validationResult.IsFailure) { return validationResult; } + // Pre Merge Validation + var preMergeValidationResult = + new PreMergeValidator(_preMergeValidationRules).Validate(context); + + if (preMergeValidationResult.IsFailure) + { + return preMergeValidationResult; + } + // Merge Source Schemas var mergeResult = new SourceSchemaMerger().Merge(context); @@ -31,6 +43,15 @@ public CompositionResult Compose( return mergeResult; } + // Post Merge Validation + var postMergeValidationResult = + new PostMergeValidator(_postMergeValidationRules).Validate(mergeResult.Value); + + if (postMergeValidationResult.IsFailure) + { + return postMergeValidationResult; + } + // Validate Satisfiability var satisfiabilityResult = new SatisfiabilityValidator().Validate(mergeResult.Value); @@ -41,4 +62,48 @@ public CompositionResult Compose( return mergeResult; } + + private static readonly List _sourceSchemaValidationRules = + [ + new DisallowedInaccessibleElementsRule(), + new ExternalOnInterfaceRule(), + new ExternalUnusedRule(), + new KeyDirectiveInFieldsArgumentRule(), + new KeyFieldsHasArgumentsRule(), + new KeyFieldsSelectInvalidTypeRule(), + new KeyInvalidFieldsRule(), + new KeyInvalidFieldsTypeRule(), + new KeyInvalidSyntaxRule(), + new LookupReturnsListRule(), + new LookupReturnsNonNullableTypeRule(), + new OverrideFromSelfRule(), + new OverrideOnInterfaceRule(), + new ProvidesDirectiveInFieldsArgumentRule(), + new ProvidesFieldsHasArgumentsRule(), + new ProvidesFieldsMissingExternalRule(), + new ProvidesInvalidFieldsTypeRule(), + new ProvidesInvalidSyntaxRule(), + new ProvidesOnNonCompositeFieldRule(), + new QueryRootTypeInaccessibleRule(), + new RequireDirectiveInFieldsArgumentRule(), + new RequireInvalidFieldsTypeRule(), + new RequireInvalidSyntaxRule(), + new RootMutationUsedRule(), + new RootQueryUsedRule(), + new RootSubscriptionUsedRule() + ]; + + private static readonly List _preMergeValidationRules = + [ + new EnumValuesMismatchRule(), + new ExternalArgumentDefaultMismatchRule(), + new ExternalMissingOnBaseRule(), + new FieldArgumentTypesMergeableRule(), + new InputFieldDefaultMismatchRule(), + new InputFieldTypesMergeableRule(), + new InputWithMissingRequiredFieldsRule(), + new OutputFieldTypesMergeableRule() + ]; + + private static readonly List _postMergeValidationRules = []; } diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs index 94be53f413e..7b5fd9b7f49 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaMerger.cs @@ -1,6 +1,3 @@ -using HotChocolate.Fusion.PostMergeValidation; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; using HotChocolate.Fusion.Results; using HotChocolate.Skimmed; @@ -8,77 +5,9 @@ namespace HotChocolate.Fusion; internal sealed class SourceSchemaMerger { - public CompositionResult Merge(CompositionContext context) - { - // Pre Merge Validation - var preMergeValidationResult = - new PreMergeValidator(_preMergeValidationRules).Validate(context); - - if (preMergeValidationResult.IsFailure) - { - return preMergeValidationResult; - } - - // Merge - var mergeResult = MergeSchemaDefinitions(context); - - if (mergeResult.IsFailure) - { - return mergeResult; - } - - // Post Merge Validation - var postMergeValidationResult = new PostMergeValidator().Validate(mergeResult.Value); - - if (postMergeValidationResult.IsFailure) - { - return postMergeValidationResult; - } - - return mergeResult; - } - - private CompositionResult MergeSchemaDefinitions(CompositionContext _) + public CompositionResult Merge(CompositionContext _) { // FIXME: Implement. return new SchemaDefinition(); } - - private static readonly List _preMergeValidationRules = - [ - new DisallowedInaccessibleElementsRule(), - new EnumValuesMismatchRule(), - new ExternalArgumentDefaultMismatchRule(), - new ExternalMissingOnBaseRule(), - new ExternalOnInterfaceRule(), - new ExternalUnusedRule(), - new FieldArgumentTypesMergeableRule(), - new InputFieldDefaultMismatchRule(), - new InputFieldTypesMergeableRule(), - new InputWithMissingRequiredFieldsRule(), - new KeyDirectiveInFieldsArgumentRule(), - new KeyFieldsHasArgumentsRule(), - new KeyFieldsSelectInvalidTypeRule(), - new KeyInvalidFieldsRule(), - new KeyInvalidFieldsTypeRule(), - new KeyInvalidSyntaxRule(), - new LookupReturnsListRule(), - new LookupReturnsNonNullableTypeRule(), - new OutputFieldTypesMergeableRule(), - new OverrideFromSelfRule(), - new OverrideOnInterfaceRule(), - new ProvidesDirectiveInFieldsArgumentRule(), - new ProvidesFieldsHasArgumentsRule(), - new ProvidesFieldsMissingExternalRule(), - new ProvidesInvalidFieldsTypeRule(), - new ProvidesInvalidSyntaxRule(), - new ProvidesOnNonCompositeFieldRule(), - new QueryRootTypeInaccessibleRule(), - new RequireDirectiveInFieldsArgumentRule(), - new RequireInvalidFieldsTypeRule(), - new RequireInvalidSyntaxRule(), - new RootMutationUsedRule(), - new RootQueryUsedRule(), - new RootSubscriptionUsedRule() - ]; } diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Events.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Events.cs new file mode 100644 index 00000000000..1079a3d3d17 --- /dev/null +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Events.cs @@ -0,0 +1,110 @@ +using System.Collections.Immutable; +using HotChocolate.Fusion.Events; +using HotChocolate.Language; +using HotChocolate.Skimmed; + +namespace HotChocolate.Fusion.SourceSchemaValidation; + +internal record DirectiveArgumentEvent( + InputFieldDefinition Argument, + DirectiveDefinition Directive, + SchemaDefinition Schema) : IEvent; + +internal record FieldArgumentEvent( + InputFieldDefinition Argument, + OutputFieldDefinition Field, + INamedTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record KeyFieldEvent( + Directive KeyDirective, + ComplexTypeDefinition EntityType, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record KeyFieldNodeEvent( + FieldNode FieldNode, + ImmutableArray FieldNamePath, + Directive KeyDirective, + ComplexTypeDefinition EntityType, + SchemaDefinition Schema) : IEvent; + +internal record KeyFieldsInvalidReferenceEvent( + FieldNode FieldNode, + ComplexTypeDefinition Type, + Directive KeyDirective, + ComplexTypeDefinition EntityType, + SchemaDefinition Schema) : IEvent; + +internal record KeyFieldsInvalidSyntaxEvent( + Directive KeyDirective, + ComplexTypeDefinition EntityType, + SchemaDefinition Schema) : IEvent; + +internal record KeyFieldsInvalidTypeEvent( + Directive KeyDirective, + ComplexTypeDefinition EntityType, + SchemaDefinition Schema) : IEvent; + +internal record OutputFieldEvent( + OutputFieldDefinition Field, + INamedTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record ProvidesFieldEvent( + OutputFieldDefinition ProvidedField, + ComplexTypeDefinition ProvidedType, + Directive ProvidesDirective, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record ProvidesFieldNodeEvent( + FieldNode FieldNode, + ImmutableArray FieldNamePath, + Directive ProvidesDirective, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record ProvidesFieldsInvalidSyntaxEvent( + Directive ProvidesDirective, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record ProvidesFieldsInvalidTypeEvent( + Directive ProvidesDirective, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record RequireFieldNodeEvent( + FieldNode FieldNode, + ImmutableArray FieldNamePath, + Directive RequireDirective, + InputFieldDefinition Argument, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record RequireFieldsInvalidSyntaxEvent( + Directive RequireDirective, + InputFieldDefinition Argument, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record RequireFieldsInvalidTypeEvent( + Directive RequireDirective, + InputFieldDefinition Argument, + OutputFieldDefinition Field, + ComplexTypeDefinition Type, + SchemaDefinition Schema) : IEvent; + +internal record SchemaEvent(SchemaDefinition Schema) : IEvent; + +internal record TypeEvent( + INamedTypeDefinition Type, + SchemaDefinition Schema) : IEvent; diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/DisallowedInaccessibleElementsRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/DisallowedInaccessibleElementsRule.cs similarity index 98% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/DisallowedInaccessibleElementsRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/DisallowedInaccessibleElementsRule.cs index 5ce9c49bc68..8d0e3cef706 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/DisallowedInaccessibleElementsRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/DisallowedInaccessibleElementsRule.cs @@ -3,7 +3,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// This rule ensures that certain essential elements of a GraphQL schema, particularly built-in diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ExternalOnInterfaceRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ExternalOnInterfaceRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ExternalOnInterfaceRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ExternalOnInterfaceRule.cs index d15bd16d365..87a44e83ed2 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ExternalOnInterfaceRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ExternalOnInterfaceRule.cs @@ -3,7 +3,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @external directive indicates that a field is defined and resolved elsewhere, not in diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ExternalUnusedRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ExternalUnusedRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ExternalUnusedRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ExternalUnusedRule.cs index a25d9936141..6c448c1a800 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ExternalUnusedRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ExternalUnusedRule.cs @@ -4,7 +4,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// This rule ensures that every field marked as @external in a source schema is actually diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyDirectiveInFieldsArgumentRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyDirectiveInFieldsArgumentRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyDirectiveInFieldsArgumentRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyDirectiveInFieldsArgumentRule.cs index c7f0e2e4d30..fc77be23088 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyDirectiveInFieldsArgumentRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyDirectiveInFieldsArgumentRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @key directive specifies the set of fields used to uniquely identify an entity. The diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyFieldsHasArgumentsRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyFieldsHasArgumentsRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyFieldsHasArgumentsRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyFieldsHasArgumentsRule.cs index f8cb7206aac..d3d288043db 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyFieldsHasArgumentsRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyFieldsHasArgumentsRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @key directive is used to define the set of fields that uniquely identify an entity. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyFieldsSelectInvalidTypeRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyFieldsSelectInvalidTypeRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyFieldsSelectInvalidTypeRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyFieldsSelectInvalidTypeRule.cs index 5e18aeebf71..e4192c3195b 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyFieldsSelectInvalidTypeRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyFieldsSelectInvalidTypeRule.cs @@ -2,7 +2,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @key directive is used to define the set of fields that uniquely identify an entity. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidFieldsRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidFieldsRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidFieldsRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidFieldsRule.cs index 1af26196ab1..fb947dc1667 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidFieldsRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidFieldsRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// Even if the selection set for @key(fields: "…") is syntactically valid, field references diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidFieldsTypeRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidFieldsTypeRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidFieldsTypeRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidFieldsTypeRule.cs index 6c8eb308d8f..3e6356ff7ef 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidFieldsTypeRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidFieldsTypeRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @key directive designates the fields used to identify a particular object uniquely. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidSyntaxRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidSyntaxRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidSyntaxRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidSyntaxRule.cs index cba26983bf3..b45d0039457 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/KeyInvalidSyntaxRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/KeyInvalidSyntaxRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// Each @key directive must specify the fields that uniquely identify an entity using a diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/LookupReturnsListRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/LookupReturnsListRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/LookupReturnsListRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/LookupReturnsListRule.cs index 9fcb8aea949..24741194a86 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/LookupReturnsListRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/LookupReturnsListRule.cs @@ -3,7 +3,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// Fields annotated with the @lookup directive are intended to retrieve a single entity diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/LookupReturnsNonNullableTypeRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/LookupReturnsNonNullableTypeRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/LookupReturnsNonNullableTypeRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/LookupReturnsNonNullableTypeRule.cs index f85b3d901ae..d17dc3dd1ef 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/LookupReturnsNonNullableTypeRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/LookupReturnsNonNullableTypeRule.cs @@ -3,7 +3,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// Fields annotated with the @lookup directive are intended to retrieve a single entity diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/OverrideFromSelfRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/OverrideFromSelfRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/OverrideFromSelfRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/OverrideFromSelfRule.cs index 8b59156f530..45fe1472996 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/OverrideFromSelfRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/OverrideFromSelfRule.cs @@ -4,7 +4,7 @@ using static HotChocolate.Fusion.WellKnownArgumentNames; using static HotChocolate.Fusion.WellKnownDirectiveNames; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// When using @override, the from argument indicates the name of the source schema diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/OverrideOnInterfaceRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/OverrideOnInterfaceRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/OverrideOnInterfaceRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/OverrideOnInterfaceRule.cs index d0721ac1e5f..5a22f5928eb 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/OverrideOnInterfaceRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/OverrideOnInterfaceRule.cs @@ -3,7 +3,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @override directive designates that ownership of a field is transferred from one diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesDirectiveInFieldsArgumentRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesDirectiveInFieldsArgumentRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesDirectiveInFieldsArgumentRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesDirectiveInFieldsArgumentRule.cs index f3938bf50e1..f884fe9fb82 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesDirectiveInFieldsArgumentRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesDirectiveInFieldsArgumentRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @provides directive is used to specify the set of fields on an object type that a diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesFieldsHasArgumentsRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesFieldsHasArgumentsRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesFieldsHasArgumentsRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesFieldsHasArgumentsRule.cs index 7937fe9ead8..7e5837d4889 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesFieldsHasArgumentsRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesFieldsHasArgumentsRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @provides directive specifies fields that a resolver provides for the parent type. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesFieldsMissingExternalRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesFieldsMissingExternalRule.cs similarity index 96% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesFieldsMissingExternalRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesFieldsMissingExternalRule.cs index 7fcc58a5743..2ccfc2c2c98 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesFieldsMissingExternalRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesFieldsMissingExternalRule.cs @@ -2,7 +2,7 @@ using HotChocolate.Fusion.Extensions; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesInvalidFieldsTypeRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesInvalidFieldsTypeRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesInvalidFieldsTypeRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesInvalidFieldsTypeRule.cs index f657a6fd4d2..fa33829fc77 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesInvalidFieldsTypeRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesInvalidFieldsTypeRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @provides directive indicates that a field is providing one or more additional diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesInvalidSyntaxRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesInvalidSyntaxRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesInvalidSyntaxRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesInvalidSyntaxRule.cs index 35e314cf9a8..3fc861e45fa 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesInvalidSyntaxRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesInvalidSyntaxRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @provides directive’s fields argument must be a syntactically valid selection diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesOnNonCompositeFieldRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesOnNonCompositeFieldRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesOnNonCompositeFieldRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesOnNonCompositeFieldRule.cs index 595d3defc28..4687928adb6 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/ProvidesOnNonCompositeFieldRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/ProvidesOnNonCompositeFieldRule.cs @@ -3,7 +3,7 @@ using HotChocolate.Skimmed; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @provides directive allows a field to “provide” additional nested fields on the diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/QueryRootTypeInaccessibleRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/QueryRootTypeInaccessibleRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/QueryRootTypeInaccessibleRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/QueryRootTypeInaccessibleRule.cs index 95fd4d1c643..d3eaa538246 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/QueryRootTypeInaccessibleRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/QueryRootTypeInaccessibleRule.cs @@ -2,7 +2,7 @@ using HotChocolate.Fusion.Extensions; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// Every source schema that contributes to the final composite schema must expose a public diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireDirectiveInFieldsArgumentRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireDirectiveInFieldsArgumentRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireDirectiveInFieldsArgumentRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireDirectiveInFieldsArgumentRule.cs index 3f57e419302..746fc86875a 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireDirectiveInFieldsArgumentRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireDirectiveInFieldsArgumentRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @require directive is used to specify fields on the same type that an argument diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireInvalidFieldsTypeRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireInvalidFieldsTypeRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireInvalidFieldsTypeRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireInvalidFieldsTypeRule.cs index d13133915b7..a3bc90d12a6 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireInvalidFieldsTypeRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireInvalidFieldsTypeRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// When using the @require directive, the fields argument must always be a string diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireInvalidSyntaxRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireInvalidSyntaxRule.cs similarity index 94% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireInvalidSyntaxRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireInvalidSyntaxRule.cs index 41b1fd61679..34dd4267bf1 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RequireInvalidSyntaxRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RequireInvalidSyntaxRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// The @require directive’s fields argument must be syntactically valid GraphQL. If diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootMutationUsedRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootMutationUsedRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootMutationUsedRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootMutationUsedRule.cs index 9c7bc3ab2ae..fd4ddd25686 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootMutationUsedRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootMutationUsedRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// This rule enforces that, for any source schema, if a root mutation type is defined, it must be diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootQueryUsedRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootQueryUsedRule.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootQueryUsedRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootQueryUsedRule.cs index 4477bfaf735..ee1c8977544 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootQueryUsedRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootQueryUsedRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// This rule enforces that the root query type in any source schema must be named Query. diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootSubscriptionUsedRule.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootSubscriptionUsedRule.cs similarity index 96% rename from src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootSubscriptionUsedRule.cs rename to src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootSubscriptionUsedRule.cs index 4a6dc2f9097..c8e44730833 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/PreMergeValidation/Rules/RootSubscriptionUsedRule.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidation/Rules/RootSubscriptionUsedRule.cs @@ -1,7 +1,7 @@ using HotChocolate.Fusion.Events; using static HotChocolate.Fusion.Logging.LogEntryHelper; -namespace HotChocolate.Fusion.PreMergeValidation.Rules; +namespace HotChocolate.Fusion.SourceSchemaValidation.Rules; /// /// This rule enforces that, for any source schema, if a root subscription type is defined, it must diff --git a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidator.cs b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidator.cs index 67e91bc4258..1fd64acc9da 100644 --- a/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidator.cs +++ b/src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SourceSchemaValidator.cs @@ -1,12 +1,417 @@ +using System.Collections.Immutable; +using HotChocolate.Fusion.Errors; +using HotChocolate.Fusion.Events; using HotChocolate.Fusion.Results; +using HotChocolate.Fusion.SourceSchemaValidation; +using HotChocolate.Language; +using HotChocolate.Skimmed; +using static HotChocolate.Fusion.WellKnownArgumentNames; +using static HotChocolate.Fusion.WellKnownDirectiveNames; +using static HotChocolate.Language.Utf8GraphQLParser; namespace HotChocolate.Fusion; -internal sealed class SourceSchemaValidator +internal sealed class SourceSchemaValidator(IEnumerable rules) { - public CompositionResult Validate(CompositionContext _) + private readonly ImmutableArray _rules = [.. rules]; + + public CompositionResult Validate(CompositionContext context) + { + PublishEvents(context); + + return context.Log.HasErrors + ? ErrorHelper.SourceSchemaValidationFailed() + : CompositionResult.Success(); + } + + private void PublishEvents(CompositionContext context) + { + foreach (var schema in context.SchemaDefinitions) + { + PublishEvent(new SchemaEvent(schema), context); + + foreach (var type in schema.Types) + { + PublishEvent(new TypeEvent(type, schema), context); + + if (type is ComplexTypeDefinition complexType) + { + if (complexType.Directives.ContainsName(Key)) + { + PublishEntityEvents(complexType, schema, context); + } + + foreach (var field in complexType.Fields) + { + PublishEvent(new OutputFieldEvent(field, type, schema), context); + + if (field.Directives.ContainsName(Provides)) + { + PublishProvidesEvents(field, complexType, schema, context); + } + + foreach (var argument in field.Arguments) + { + PublishEvent( + new FieldArgumentEvent(argument, field, type, schema), context); + + if (argument.Directives.ContainsName(Require)) + { + PublishRequireEvents( + argument, + field, + complexType, + schema, + context); + } + } + } + } + } + + foreach (var directive in schema.DirectiveDefinitions) + { + foreach (var argument in directive.Arguments) + { + PublishEvent(new DirectiveArgumentEvent(argument, directive, schema), context); + } + } + } + } + + private void PublishEvent(TEvent @event, CompositionContext context) + where TEvent : IEvent { - // FIXME: Implement. - return CompositionResult.Success(); + foreach (var rule in _rules) + { + if (rule is IEventHandler handler) + { + handler.Handle(@event, context); + } + } + } + + private void PublishEntityEvents( + ComplexTypeDefinition entityType, + SchemaDefinition schema, + CompositionContext context) + { + var keyDirectives = + entityType.Directives + .Where(d => d.Name == Key) + .ToArray(); + + foreach (var keyDirective in keyDirectives) + { + if (!keyDirective.Arguments.TryGetValue(Fields, out var f) + || f is not StringValueNode fields) + { + PublishEvent( + new KeyFieldsInvalidTypeEvent(keyDirective, entityType, schema), + context); + + continue; + } + + try + { + var selectionSet = Syntax.ParseSelectionSet($"{{{fields.Value}}}"); + + PublishKeyFieldEvents( + selectionSet, + entityType, + keyDirective, + [], + entityType, + schema, + context); + } + catch (SyntaxException) + { + PublishEvent( + new KeyFieldsInvalidSyntaxEvent(keyDirective, entityType, schema), + context); + } + } + } + + private void PublishKeyFieldEvents( + SelectionSetNode selectionSet, + ComplexTypeDefinition entityType, + Directive keyDirective, + List fieldNamePath, + ComplexTypeDefinition? parentType, + SchemaDefinition schema, + CompositionContext context) + { + ComplexTypeDefinition? nextParentType = null; + + foreach (var selection in selectionSet.Selections) + { + if (selection is FieldNode fieldNode) + { + fieldNamePath.Add(fieldNode.Name.Value); + + PublishEvent( + new KeyFieldNodeEvent( + fieldNode, + [.. fieldNamePath], + keyDirective, + entityType, + schema), + context); + + if (parentType is not null) + { + if (parentType.Fields.TryGetField(fieldNode.Name.Value, out var field)) + { + PublishEvent( + new KeyFieldEvent( + keyDirective, + entityType, + field, + parentType, + schema), + context); + + if (field.Type.NullableType() is ComplexTypeDefinition fieldType) + { + nextParentType = fieldType; + } + } + else + { + PublishEvent( + new KeyFieldsInvalidReferenceEvent( + fieldNode, + parentType, + keyDirective, + entityType, + schema), + context); + + nextParentType = null; + } + } + + if (fieldNode.SelectionSet is not null) + { + PublishKeyFieldEvents( + fieldNode.SelectionSet, + entityType, + keyDirective, + fieldNamePath, + nextParentType, + schema, + context); + } + + fieldNamePath = []; + } + } + } + + private void PublishProvidesEvents( + OutputFieldDefinition field, + ComplexTypeDefinition type, + SchemaDefinition schema, + CompositionContext context) + { + var providesDirective = field.Directives.First(d => d.Name == Provides); + + if (!providesDirective.Arguments.TryGetValue(Fields, out var f) + || f is not StringValueNode fields) + { + PublishEvent( + new ProvidesFieldsInvalidTypeEvent(providesDirective, field, type, schema), + context); + + return; + } + + try + { + var selectionSet = Syntax.ParseSelectionSet($"{{{fields.Value}}}"); + + PublishProvidesFieldEvents( + selectionSet, + field, + type, + providesDirective, + [], + field.Type, + schema, + context); + } + catch (SyntaxException) + { + PublishEvent( + new ProvidesFieldsInvalidSyntaxEvent(providesDirective, field, type, schema), + context); + } + } + + private void PublishProvidesFieldEvents( + SelectionSetNode selectionSet, + OutputFieldDefinition field, + ComplexTypeDefinition type, + Directive providesDirective, + List fieldNamePath, + ITypeDefinition? parentType, + SchemaDefinition schema, + CompositionContext context) + { + ComplexTypeDefinition? nextParentType = null; + + foreach (var selection in selectionSet.Selections) + { + if (selection is FieldNode fieldNode) + { + fieldNamePath.Add(fieldNode.Name.Value); + + PublishEvent( + new ProvidesFieldNodeEvent( + fieldNode, + [.. fieldNamePath], + providesDirective, + field, + type, + schema), + context); + + if (parentType?.NullableType() is ComplexTypeDefinition providedType) + { + if (providedType.Fields.TryGetField( + fieldNode.Name.Value, + out var providedField)) + { + PublishEvent( + new ProvidesFieldEvent( + providedField, + providedType, + providesDirective, + field, + type, + schema), + context); + + if (providedField.Type.NullableType() is ComplexTypeDefinition fieldType) + { + nextParentType = fieldType; + } + } + else + { + nextParentType = null; + } + } + + if (fieldNode.SelectionSet is not null) + { + PublishProvidesFieldEvents( + fieldNode.SelectionSet, + field, + type, + providesDirective, + fieldNamePath, + nextParentType, + schema, + context); + } + + fieldNamePath = []; + } + } + } + + private void PublishRequireEvents( + InputFieldDefinition argument, + OutputFieldDefinition field, + ComplexTypeDefinition type, + SchemaDefinition schema, + CompositionContext context) + { + var requireDirective = argument.Directives.First(d => d.Name == Require); + + if (!requireDirective.Arguments.TryGetValue(Fields, out var f) + || f is not StringValueNode fields) + { + PublishEvent( + new RequireFieldsInvalidTypeEvent(requireDirective, argument, field, type, schema), + context); + + return; + } + + try + { + var selectionSet = Syntax.ParseSelectionSet($"{{{fields.Value}}}"); + + PublishRequireFieldEvents( + selectionSet, + argument, + field, + type, + requireDirective, + [], + schema, + context); + } + catch (SyntaxException) + { + PublishEvent( + new RequireFieldsInvalidSyntaxEvent( + requireDirective, + argument, + field, + type, + schema), + context); + } + } + + private void PublishRequireFieldEvents( + SelectionSetNode selectionSet, + InputFieldDefinition argument, + OutputFieldDefinition field, + ComplexTypeDefinition type, + Directive requireDirective, + List fieldNamePath, + SchemaDefinition schema, + CompositionContext context) + { + foreach (var selection in selectionSet.Selections) + { + if (selection is FieldNode fieldNode) + { + fieldNamePath.Add(fieldNode.Name.Value); + + PublishEvent( + new RequireFieldNodeEvent( + fieldNode, + [.. fieldNamePath], + requireDirective, + argument, + field, + type, + schema), + context); + + if (fieldNode.SelectionSet is not null) + { + PublishRequireFieldEvents( + fieldNode.SelectionSet, + argument, + field, + type, + requireDirective, + fieldNamePath, + schema, + context); + } + + fieldNamePath = []; + } + } } } diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs index 2be30e48fc3..2577c5b3c59 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/EnumValuesMismatchRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalArgumentDefaultMismatchRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalArgumentDefaultMismatchRuleTests.cs index 12c49292d76..bf105e7776a 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalArgumentDefaultMismatchRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalArgumentDefaultMismatchRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalMissingOnBaseRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalMissingOnBaseRuleTests.cs index 0fafaefa6fe..308d92c2a48 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalMissingOnBaseRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalMissingOnBaseRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/FieldArgumentTypesMergeableRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/FieldArgumentTypesMergeableRuleTests.cs index 9f7a8c778e7..53e17400631 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/FieldArgumentTypesMergeableRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/FieldArgumentTypesMergeableRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldDefaultMismatchRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldDefaultMismatchRuleTests.cs index 70871763e38..6ee822af850 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldDefaultMismatchRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldDefaultMismatchRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldTypesMergeableRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldTypesMergeableRuleTests.cs index a0f1401b538..52d62e3677c 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldTypesMergeableRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputFieldTypesMergeableRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputWithMissingRequiredFieldsRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputWithMissingRequiredFieldsRuleTests.cs index efed9a4455a..7d3568f78b5 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputWithMissingRequiredFieldsRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/InputWithMissingRequiredFieldsRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OutputFieldTypesMergeableRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OutputFieldTypesMergeableRuleTests.cs index a3491b93201..8718e558a28 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OutputFieldTypesMergeableRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OutputFieldTypesMergeableRuleTests.cs @@ -1,5 +1,5 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; using HotChocolate.Fusion.PreMergeValidation.Rules; namespace HotChocolate.Composition.PreMergeValidation.Rules; diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/DisallowedInaccessibleElementsRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/DisallowedInaccessibleElementsRuleTests.cs similarity index 92% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/DisallowedInaccessibleElementsRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/DisallowedInaccessibleElementsRuleTests.cs index e62c790a358..cce761ff9ca 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/DisallowedInaccessibleElementsRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/DisallowedInaccessibleElementsRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class DisallowedInaccessibleElementsRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new DisallowedInaccessibleElementsRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalOnInterfaceRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ExternalOnInterfaceRuleTests.cs similarity index 88% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalOnInterfaceRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ExternalOnInterfaceRuleTests.cs index 4a362e588f1..9d50269379b 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalOnInterfaceRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ExternalOnInterfaceRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ExternalOnInterfaceRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ExternalOnInterfaceRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalUnusedRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ExternalUnusedRuleTests.cs similarity index 90% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalUnusedRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ExternalUnusedRuleTests.cs index 51b2f486666..f4a9f4de638 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ExternalUnusedRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ExternalUnusedRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ExternalUnusedRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new ExternalUnusedRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ExternalUnusedRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +16,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +31,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs similarity index 92% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs index 9439b732f56..2cc7392f799 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyDirectiveInFieldsArgumentRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class KeyDirectiveInFieldsArgumentRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new KeyDirectiveInFieldsArgumentRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyFieldsHasArgumentsRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyFieldsHasArgumentsRuleTests.cs similarity index 90% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyFieldsHasArgumentsRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyFieldsHasArgumentsRuleTests.cs index 9430a9d85e7..9053dfe233d 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyFieldsHasArgumentsRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyFieldsHasArgumentsRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class KeyFieldsHasArgumentsRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new KeyFieldsHasArgumentsRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new KeyFieldsHasArgumentsRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs similarity index 95% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs index 4552bad261e..50637c42470 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyFieldsSelectInvalidTypeRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class KeyFieldsSelectInvalidTypeRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new KeyFieldsSelectInvalidTypeRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidFieldsRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidFieldsRuleTests.cs similarity index 92% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidFieldsRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidFieldsRuleTests.cs index 1994265b1e3..c1dc72d2045 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidFieldsRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidFieldsRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class KeyInvalidFieldsRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new KeyInvalidFieldsRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new KeyInvalidFieldsRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidFieldsTypeRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidFieldsTypeRuleTests.cs similarity index 88% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidFieldsTypeRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidFieldsTypeRuleTests.cs index 9b782c24817..7badfecc405 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidFieldsTypeRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidFieldsTypeRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class KeyInvalidFieldsTypeRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new KeyInvalidFieldsTypeRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new KeyInvalidFieldsTypeRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidSyntaxRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidSyntaxRuleTests.cs similarity index 86% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidSyntaxRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidSyntaxRuleTests.cs index 42158c19ecc..54800854b41 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/KeyInvalidSyntaxRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/KeyInvalidSyntaxRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class KeyInvalidSyntaxRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new KeyInvalidSyntaxRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new KeyInvalidSyntaxRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/LookupReturnsListRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/LookupReturnsListRuleTests.cs similarity index 88% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/LookupReturnsListRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/LookupReturnsListRuleTests.cs index fe6fdd5406d..656b21163f1 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/LookupReturnsListRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/LookupReturnsListRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class LookupReturnsListRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new LookupReturnsListRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new LookupReturnsListRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/LookupReturnsNonNullableTypeRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/LookupReturnsNonNullableTypeRuleTests.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/LookupReturnsNonNullableTypeRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/LookupReturnsNonNullableTypeRuleTests.cs index ec32ed0a28e..12181dced79 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/LookupReturnsNonNullableTypeRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/LookupReturnsNonNullableTypeRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class LookupReturnsNonNullableTypeRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new LookupReturnsNonNullableTypeRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OverrideFromSelfRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/OverrideFromSelfRuleTests.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OverrideFromSelfRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/OverrideFromSelfRuleTests.cs index 6ad9b1435a6..18777ac76be 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OverrideFromSelfRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/OverrideFromSelfRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class OverrideFromSelfRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new OverrideFromSelfRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new OverrideFromSelfRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OverrideOnInterfaceRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/OverrideOnInterfaceRuleTests.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OverrideOnInterfaceRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/OverrideOnInterfaceRuleTests.cs index c2b66060515..66dcae563ae 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/OverrideOnInterfaceRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/OverrideOnInterfaceRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class OverrideOnInterfaceRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new OverrideOnInterfaceRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new OverrideOnInterfaceRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs similarity index 93% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs index 673ed48f21b..91986bdf895 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesDirectiveInFieldsArgumentRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ProvidesDirectiveInFieldsArgumentRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ProvidesDirectiveInFieldsArgumentRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesFieldsHasArgumentsRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesFieldsHasArgumentsRuleTests.cs similarity index 91% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesFieldsHasArgumentsRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesFieldsHasArgumentsRuleTests.cs index bc71f7a9a4a..2746b72acce 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesFieldsHasArgumentsRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesFieldsHasArgumentsRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ProvidesFieldsHasArgumentsRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ProvidesFieldsHasArgumentsRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesFieldsMissingExternalRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesFieldsMissingExternalRuleTests.cs similarity index 91% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesFieldsMissingExternalRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesFieldsMissingExternalRuleTests.cs index ee7ed635b1e..d7fa66b72e4 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesFieldsMissingExternalRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesFieldsMissingExternalRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ProvidesFieldsMissingExternalRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ProvidesFieldsMissingExternalRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesInvalidFieldsTypeRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesInvalidFieldsTypeRuleTests.cs similarity index 89% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesInvalidFieldsTypeRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesInvalidFieldsTypeRuleTests.cs index 9af9b462f76..4de7633e8ef 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesInvalidFieldsTypeRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesInvalidFieldsTypeRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ProvidesInvalidFieldsTypeRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ProvidesInvalidFieldsTypeRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesInvalidSyntaxRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesInvalidSyntaxRuleTests.cs similarity index 86% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesInvalidSyntaxRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesInvalidSyntaxRuleTests.cs index 9c933e20395..27d0233db86 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesInvalidSyntaxRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesInvalidSyntaxRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ProvidesInvalidSyntaxRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new ProvidesInvalidSyntaxRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new ProvidesInvalidSyntaxRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesOnNonCompositeFieldRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesOnNonCompositeFieldRuleTests.cs similarity index 91% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesOnNonCompositeFieldRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesOnNonCompositeFieldRuleTests.cs index 9ac429972be..3b9429bdb6a 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/ProvidesOnNonCompositeFieldRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/ProvidesOnNonCompositeFieldRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class ProvidesOnNonCompositeFieldRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new ProvidesOnNonCompositeFieldRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/QueryRootTypeInaccessibleRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/QueryRootTypeInaccessibleRuleTests.cs similarity index 88% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/QueryRootTypeInaccessibleRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/QueryRootTypeInaccessibleRuleTests.cs index 34552d7dcd2..deb4ae09e0d 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/QueryRootTypeInaccessibleRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/QueryRootTypeInaccessibleRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class QueryRootTypeInaccessibleRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new QueryRootTypeInaccessibleRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs similarity index 93% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs index f8a16d689b8..388055f54f2 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireDirectiveInFieldsArgumentRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class RequireDirectiveInFieldsArgumentRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new RequireDirectiveInFieldsArgumentRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireInvalidFieldsTypeRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireInvalidFieldsTypeRuleTests.cs similarity index 88% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireInvalidFieldsTypeRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireInvalidFieldsTypeRuleTests.cs index ef1bcf71970..addaa239deb 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireInvalidFieldsTypeRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireInvalidFieldsTypeRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class RequireInvalidFieldsTypeRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new RequireInvalidFieldsTypeRule()]); [Theory] @@ -17,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -32,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireInvalidSyntaxRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireInvalidSyntaxRuleTests.cs similarity index 86% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireInvalidSyntaxRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireInvalidSyntaxRuleTests.cs index e9c74fd534c..a6659e40b65 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RequireInvalidSyntaxRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RequireInvalidSyntaxRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class RequireInvalidSyntaxRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new RequireInvalidSyntaxRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new RequireInvalidSyntaxRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootMutationUsedRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootMutationUsedRuleTests.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootMutationUsedRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootMutationUsedRuleTests.cs index 3c7a5d6aee2..29e5cd53b36 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootMutationUsedRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootMutationUsedRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class RootMutationUsedRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new RootMutationUsedRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new RootMutationUsedRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootQueryUsedRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootQueryUsedRuleTests.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootQueryUsedRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootQueryUsedRuleTests.cs index db361cfaecb..c38eaa2fb9e 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootQueryUsedRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootQueryUsedRuleTests.cs @@ -1,12 +1,12 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class RootQueryUsedRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new RootQueryUsedRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = new([new RootQueryUsedRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +16,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +31,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure); diff --git a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootSubscriptionUsedRuleTests.cs b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootSubscriptionUsedRuleTests.cs similarity index 87% rename from src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootSubscriptionUsedRuleTests.cs rename to src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootSubscriptionUsedRuleTests.cs index 50385c23858..3c09286a90c 100644 --- a/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/PreMergeValidation/Rules/RootSubscriptionUsedRuleTests.cs +++ b/src/HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/SourceSchemaValidation/Rules/RootSubscriptionUsedRuleTests.cs @@ -1,12 +1,13 @@ +using HotChocolate.Fusion; using HotChocolate.Fusion.Logging; -using HotChocolate.Fusion.PreMergeValidation; -using HotChocolate.Fusion.PreMergeValidation.Rules; +using HotChocolate.Fusion.SourceSchemaValidation.Rules; -namespace HotChocolate.Composition.PreMergeValidation.Rules; +namespace HotChocolate.Composition.SourceSchemaValidation.Rules; public sealed class RootSubscriptionUsedRuleTests : CompositionTestBase { - private readonly PreMergeValidator _preMergeValidator = new([new RootSubscriptionUsedRule()]); + private readonly SourceSchemaValidator _sourceSchemaValidator = + new([new RootSubscriptionUsedRule()]); [Theory] [MemberData(nameof(ValidExamplesData))] @@ -16,7 +17,7 @@ public void Examples_Valid(string[] sdl) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsSuccess); @@ -31,7 +32,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages) var context = CreateCompositionContext(sdl); // act - var result = _preMergeValidator.Validate(context); + var result = _sourceSchemaValidator.Validate(context); // assert Assert.True(result.IsFailure);