-
-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevented type descriptions from being overwritten while merging (#7751)
- Loading branch information
Showing
4 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/HotChocolate/Core/test/Types.Tests.Documentation/QueryExtWithDocs1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace HotChocolate.Types.Descriptors; | ||
|
||
/// <summary> | ||
/// QueryExtWithDocs1 | ||
/// </summary> | ||
[QueryType] | ||
public static class QueryExtWithDocs1 | ||
{ | ||
public static int GetFoo1() => 1; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/HotChocolate/Core/test/Types.Tests.Documentation/QueryExtWithDocs2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace HotChocolate.Types.Descriptors; | ||
|
||
/// <summary> | ||
/// QueryExtWithDocs2 | ||
/// </summary> | ||
[QueryType] | ||
public static class QueryExtWithDocs2 | ||
{ | ||
public static int GetFoo2() => 1; | ||
} |
34 changes: 34 additions & 0 deletions
34
src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/Definitions/DefinitionBaseTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using CookieCrumble; | ||
using HotChocolate.Execution; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace HotChocolate.Types.Descriptors.Definitions; | ||
|
||
public class DefinitionBaseTests | ||
{ | ||
[Fact] | ||
public async Task MergeInto_MultipleTypeExtensionXmlDescriptions_UsesQueryTypeDescription() | ||
{ | ||
// arrange & act | ||
var schema = await new ServiceCollection() | ||
.AddGraphQL() | ||
.AddQueryType(d => d.Description("Query")) | ||
.AddTypeExtension(typeof(QueryExtWithDocs1)) | ||
.AddTypeExtension(typeof(QueryExtWithDocs2)) | ||
.BuildSchemaAsync(); | ||
|
||
// assert | ||
schema.MatchInlineSnapshot( | ||
""" | ||
schema { | ||
query: Query | ||
} | ||
|
||
"Query" | ||
type Query { | ||
foo1: Int! | ||
foo2: Int! | ||
} | ||
"""); | ||
} | ||
} |