Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class LogEntryCodes
public const string InterfaceFieldNoImplementation = "INTERFACE_FIELD_NO_IMPLEMENTATION";
public const string InvalidGraphQL = "INVALID_GRAPHQL";
public const string InvalidShareableUsage = "INVALID_SHAREABLE_USAGE";
public const string IsInvalidField = "IS_INVALID_FIELD";
public const string IsInvalidFields = "IS_INVALID_FIELDS";
public const string IsInvalidFieldType = "IS_INVALID_FIELD_TYPE";
public const string IsInvalidSyntax = "IS_INVALID_SYNTAX";
public const string IsInvalidUsage = "IS_INVALID_USAGE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public static LogEntry InvalidShareableUsage(
schema);
}

public static LogEntry IsInvalidField(
public static LogEntry IsInvalidFields(
Directive isDirective,
string argumentName,
string fieldName,
Expand All @@ -454,8 +454,8 @@ public static LogEntry IsInvalidField(
var coordinate = new SchemaCoordinate(typeName, fieldName, argumentName);

return new LogEntry(
string.Format(LogEntryHelper_IsInvalidField, coordinate, sourceSchema.Name),
LogEntryCodes.IsInvalidField,
string.Format(LogEntryHelper_IsInvalidFields, coordinate, sourceSchema.Name),
LogEntryCodes.IsInvalidFields,
LogSeverity.Error,
coordinate,
isDirective,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ namespace HotChocolate.Fusion.PostMergeValidationRules;
/// Even if the field selection map for <c>@is(field: "…")</c> is syntactically valid, its contents
/// must also be valid within the composed schema. Fields must exist on the parent type for them to
/// be referenced by <c>@is</c>. In addition, fields referencing unknown fields break the valid
/// usage of <c>@is</c>, leading to an <c>IS_INVALID_FIELD</c> error.
/// usage of <c>@is</c>, leading to an <c>IS_INVALID_FIELDS</c> error.
/// </summary>
/// <seealso href="https://graphql.github.io/composite-schemas-spec/draft/#sec-Is-Invalid-Field">
/// <seealso href="https://graphql.github.io/composite-schemas-spec/draft/#sec-Is-Invalid-Fields">
/// Specification
/// </seealso>
internal sealed class IsInvalidFieldRule : IEventHandler<SchemaEvent>
internal sealed class IsInvalidFieldsRule : IEventHandler<SchemaEvent>
{
public void Handle(SchemaEvent @event, CompositionContext context)
{
Expand Down Expand Up @@ -54,7 +54,7 @@ public void Handle(SchemaEvent @event, CompositionContext context)
if (errors.Any())
{
context.Log.Write(
IsInvalidField(
IsInvalidFields(
isDirective,
sourceArgument.Name,
sourceField.Name,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
<data name="LogEntryHelper_InvalidShareableUsage" xml:space="preserve">
<value>The interface field '{0}' in schema '{1}' must not be marked as shareable.</value>
</data>
<data name="LogEntryHelper_IsInvalidField" xml:space="preserve">
<data name="LogEntryHelper_IsInvalidFields" xml:space="preserve">
<value>The @is directive on argument '{0}' in schema '{1}' specifies an invalid field selection against the composed schema.</value>
</data>
<data name="LogEntryHelper_IsInvalidFieldType" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public CompositionResult<MutableSchemaDefinition> Compose()
new EnumTypeDefaultValueInaccessibleRule(),
new ImplementedByInaccessibleRule(),
new InterfaceFieldNoImplementationRule(),
new IsInvalidFieldRule(),
new IsInvalidFieldsRule(),
new KeyInvalidFieldsRule(),
new NonNullInputFieldIsInaccessibleRule(),
new NoQueriesRule(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace HotChocolate.Fusion.PostMergeValidationRules;

public sealed class IsInvalidFieldRuleTests
public sealed class IsInvalidFieldsRuleTests
{
private static readonly object s_rule = new IsInvalidFieldRule();
private static readonly object s_rule = new IsInvalidFieldsRule();
private static readonly ImmutableArray<object> s_rules = [s_rule];
private readonly CompositionLog _log = new();

Expand Down Expand Up @@ -49,7 +49,7 @@ public void Examples_Invalid(string[] sdl, string[] errorMessages)
// assert
Assert.True(result.IsFailure);
Assert.Equal(errorMessages, _log.Select(e => e.Message).ToArray());
Assert.True(_log.All(e => e.Code == "IS_INVALID_FIELD"));
Assert.True(_log.All(e => e.Code == "IS_INVALID_FIELDS"));
Assert.True(_log.All(e => e.Severity == LogSeverity.Error));
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public static TheoryData<string[], string[]> InvalidExamplesData()
return new TheoryData<string[], string[]>
{
// In this example, the @is directive references a field ("unknownField") that does
// not exist on the return type ("Person"), causing an IS_INVALID_FIELD error.
// not exist on the return type ("Person"), causing an IS_INVALID_FIELDS error.
{
[
"""
Expand Down
Loading