Skip to content

Commit

Permalink
Fixed enum type merging.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Sep 17, 2023
1 parent 8be686a commit f7eab8f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ private static void MergeType(
// value's deprecation reason
targetValue.MergeDeprecationWith(sourceValue);

// Try to apply the source value to the target value
context.TryApplySource(sourceValue, sourceSchema, targetValue);
// Apply the source value to the target value
context.ApplySource(sourceValue, sourceSchema, targetValue);
}
}
}
28 changes: 28 additions & 0 deletions src/HotChocolate/Fusion/test/Composition.Tests/EnumMergeTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Xunit.Abstractions;

namespace HotChocolate.Fusion.Composition;

public class EnumMergeTests(ITestOutputHelper output) : CompositionTestBase(output)
{
[Fact]
public async Task Output_Enum()
=> await Succeed(
"""
type Query {
field1: Enum1!
}
enum Enum1 {
BAR
}
""",
"""
type Query {
field1: Enum1!
}
enum Enum1 {
BAZ
}
""");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
schema
@fusion(version: 1)
@transport(subgraph: "A", location: "https:\/\/localhost:5001\/graphql", kind: "HTTP")
@transport(subgraph: "B", location: "https:\/\/localhost:5002\/graphql", kind: "HTTP") {
query: Query
}

type Query {
field1: Enum1!
@resolver(subgraph: "A", select: "{ field1 }")
@resolver(subgraph: "B", select: "{ field1 }")
}

enum Enum1 {
BAR
@source(subgraph: "A")
BAZ
@source(subgraph: "B")
}

0 comments on commit f7eab8f

Please sign in to comment.