Skip to content

Commit

Permalink
[Fusion] Restructure composition (#7927)
Browse files Browse the repository at this point in the history
  • Loading branch information
glen-84 authored Jan 13, 2025
1 parent 8d278f2 commit 3a21e79
Show file tree
Hide file tree
Showing 71 changed files with 945 additions and 895 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
@@ -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<object> rules)
{
private readonly ImmutableArray<object> _rules = [.. rules];

public CompositionResult Validate(SchemaDefinition _)
{
// FIXME: Implement.
Expand Down
Original file line number Diff line number Diff line change
@@ -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<EnumTypeInfo> TypeGroup) : IEvent;

internal record FieldArgumentEvent(
InputFieldDefinition Argument,
OutputFieldDefinition Field,
INamedTypeDefinition Type,
SchemaDefinition Schema) : IEvent;

internal record FieldArgumentGroupEvent(
string ArgumentName,
ImmutableArray<FieldArgumentInfo> ArgumentGroup,
Expand All @@ -44,104 +23,11 @@ internal record InputTypeGroupEvent(
string InputTypeName,
ImmutableArray<InputTypeInfo> InputTypeGroup) : IEvent;

internal record KeyFieldEvent(
Directive KeyDirective,
ComplexTypeDefinition EntityType,
OutputFieldDefinition Field,
ComplexTypeDefinition Type,
SchemaDefinition Schema) : IEvent;

internal record KeyFieldNodeEvent(
FieldNode FieldNode,
ImmutableArray<string> 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<OutputFieldInfo> 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<string> 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<string> 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<TypeInfo> TypeGroup) : IEvent;
Loading

0 comments on commit 3a21e79

Please sign in to comment.