Skip to content

Commit aa0b895

Browse files
authored
[Fusion] Renamed IsInvalidFieldRule to IsInvalidFieldsRule (#8741)
1 parent 7c6ba5e commit aa0b895

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryCodes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static class LogEntryCodes
2323
public const string InterfaceFieldNoImplementation = "INTERFACE_FIELD_NO_IMPLEMENTATION";
2424
public const string InvalidGraphQL = "INVALID_GRAPHQL";
2525
public const string InvalidShareableUsage = "INVALID_SHAREABLE_USAGE";
26-
public const string IsInvalidField = "IS_INVALID_FIELD";
26+
public const string IsInvalidFields = "IS_INVALID_FIELDS";
2727
public const string IsInvalidFieldType = "IS_INVALID_FIELD_TYPE";
2828
public const string IsInvalidSyntax = "IS_INVALID_SYNTAX";
2929
public const string IsInvalidUsage = "IS_INVALID_USAGE";

src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Logging/LogEntryHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public static LogEntry InvalidShareableUsage(
443443
schema);
444444
}
445445

446-
public static LogEntry IsInvalidField(
446+
public static LogEntry IsInvalidFields(
447447
Directive isDirective,
448448
string argumentName,
449449
string fieldName,
@@ -454,8 +454,8 @@ public static LogEntry IsInvalidField(
454454
var coordinate = new SchemaCoordinate(typeName, fieldName, argumentName);
455455

456456
return new LogEntry(
457-
string.Format(LogEntryHelper_IsInvalidField, coordinate, sourceSchema.Name),
458-
LogEntryCodes.IsInvalidField,
457+
string.Format(LogEntryHelper_IsInvalidFields, coordinate, sourceSchema.Name),
458+
LogEntryCodes.IsInvalidFields,
459459
LogSeverity.Error,
460460
coordinate,
461461
isDirective,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ namespace HotChocolate.Fusion.PostMergeValidationRules;
1616
/// Even if the field selection map for <c>@is(field: "…")</c> is syntactically valid, its contents
1717
/// must also be valid within the composed schema. Fields must exist on the parent type for them to
1818
/// be referenced by <c>@is</c>. In addition, fields referencing unknown fields break the valid
19-
/// usage of <c>@is</c>, leading to an <c>IS_INVALID_FIELD</c> error.
19+
/// usage of <c>@is</c>, leading to an <c>IS_INVALID_FIELDS</c> error.
2020
/// </summary>
21-
/// <seealso href="https://graphql.github.io/composite-schemas-spec/draft/#sec-Is-Invalid-Field">
21+
/// <seealso href="https://graphql.github.io/composite-schemas-spec/draft/#sec-Is-Invalid-Fields">
2222
/// Specification
2323
/// </seealso>
24-
internal sealed class IsInvalidFieldRule : IEventHandler<SchemaEvent>
24+
internal sealed class IsInvalidFieldsRule : IEventHandler<SchemaEvent>
2525
{
2626
public void Handle(SchemaEvent @event, CompositionContext context)
2727
{
@@ -54,7 +54,7 @@ public void Handle(SchemaEvent @event, CompositionContext context)
5454
if (errors.Any())
5555
{
5656
context.Log.Write(
57-
IsInvalidField(
57+
IsInvalidFields(
5858
isDirective,
5959
sourceArgument.Name,
6060
sourceField.Name,

src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/HotChocolate/Fusion-vnext/src/Fusion.Composition/Properties/CompositionResources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@
243243
<data name="LogEntryHelper_InvalidShareableUsage" xml:space="preserve">
244244
<value>The interface field '{0}' in schema '{1}' must not be marked as shareable.</value>
245245
</data>
246-
<data name="LogEntryHelper_IsInvalidField" xml:space="preserve">
246+
<data name="LogEntryHelper_IsInvalidFields" xml:space="preserve">
247247
<value>The @is directive on argument '{0}' in schema '{1}' specifies an invalid field selection against the composed schema.</value>
248248
</data>
249249
<data name="LogEntryHelper_IsInvalidFieldType" xml:space="preserve">

src/HotChocolate/Fusion-vnext/src/Fusion.Composition/SchemaComposer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public CompositionResult<MutableSchemaDefinition> Compose()
167167
new EnumTypeDefaultValueInaccessibleRule(),
168168
new ImplementedByInaccessibleRule(),
169169
new InterfaceFieldNoImplementationRule(),
170-
new IsInvalidFieldRule(),
170+
new IsInvalidFieldsRule(),
171171
new KeyInvalidFieldsRule(),
172172
new NonNullInputFieldIsInaccessibleRule(),
173173
new NoQueriesRule(),
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace HotChocolate.Fusion.PostMergeValidationRules;
77

8-
public sealed class IsInvalidFieldRuleTests
8+
public sealed class IsInvalidFieldsRuleTests
99
{
10-
private static readonly object s_rule = new IsInvalidFieldRule();
10+
private static readonly object s_rule = new IsInvalidFieldsRule();
1111
private static readonly ImmutableArray<object> s_rules = [s_rule];
1212
private readonly CompositionLog _log = new();
1313

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

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

0 commit comments

Comments
 (0)