-
-
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.
Introduced subgraph consistency check. (#6493)
- Loading branch information
1 parent
0375946
commit 990e08e
Showing
7 changed files
with
156 additions
and
1 deletion.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...istry/CurrentUser/software/microsoft/csdevkit/v1/pids/61843_133378542792508790/values.xml
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,3 @@ | ||
<values> | ||
<value name="StillAlive" type="qword">133378551816226300</value> | ||
</values> |
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
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
6 changes: 6 additions & 0 deletions
6
src/HotChocolate/Fusion/src/Composition/Properties/CompositionResources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
109 changes: 109 additions & 0 deletions
109
src/HotChocolate/Fusion/test/Composition.Tests/ErrorTests.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,109 @@ | ||
using CookieCrumble; | ||
using HotChocolate.Fusion.Shared; | ||
using HotChocolate.Skimmed.Serialization; | ||
using Xunit.Abstractions; | ||
|
||
namespace HotChocolate.Fusion.Composition; | ||
|
||
public class ErrorTests | ||
{ | ||
private readonly ITestOutputHelper _output; | ||
private readonly Func<ICompositionLog> _logFactory; | ||
|
||
public ErrorTests(ITestOutputHelper output) | ||
{ | ||
_output = output; | ||
_logFactory = () => new TestCompositionLog(output); | ||
} | ||
|
||
[Fact] | ||
public async Task Typo_In_Schema() | ||
{ | ||
const string schema = | ||
""" | ||
type Author { | ||
id: ID! | ||
reviews: ReviewConnection | ||
} | ||
type Book { | ||
id: ID! | ||
reviews: ReviewConnection | ||
} | ||
input CreateReviewInput { | ||
bookId: ID! | ||
reviewerId: ID! | ||
authorId: ID! | ||
comment: String! | ||
rating: Int! | ||
} | ||
input DeleteReviewInput { | ||
id: ID! | ||
} | ||
type Review { | ||
id: ID! | ||
bookId: ID! | ||
reviewerId: ID! | ||
authorId: ID! | ||
comment: String! | ||
rating: Int! | ||
} | ||
type ReviewConnection { | ||
items: [Review] | ||
nextToken: String | ||
} | ||
type Mutation { | ||
createReview(input: CreateReviewInput!): Review | ||
deleteReview(input: DeleteReviewInput!): Review | ||
} | ||
type Query { | ||
getReview(id: ID!): Review | ||
listReviews(limit: Int, nextToken: String): ReviewConnection | ||
queryReviewsByBook(bookId: ID!, limit: int, nextToken: String): ReviewConnection | ||
queryReviewsByReviewer(reviewerId: ID!, limit: int, nextToken: String): ReviewConnection | ||
queryReviewsByAuthor(authorId: ID!, limit: int, nextToken: String): ReviewConnection | ||
} | ||
schema { | ||
query: Query, | ||
mutation: Mutation | ||
} | ||
"""; | ||
|
||
var log = new ErrorCompositionLog(); | ||
var composer = new FusionGraphComposer(logFactory: () => log); | ||
|
||
var fusionConfig = await composer.TryComposeAsync( | ||
new[] | ||
{ | ||
new SubgraphConfiguration( | ||
"Test123", | ||
schema, | ||
Array.Empty<string>(), | ||
new IClientConfiguration[] | ||
{ | ||
new HttpClientConfiguration(new Uri("http://localhost")) | ||
}) | ||
}); | ||
|
||
Assert.Null(fusionConfig); | ||
Assert.True(log.HasErrors); | ||
Assert.Collection( | ||
log.Errors, | ||
a => | ||
{ | ||
Assert.Equal( | ||
"The type `int` is not declared on subgraph Test123. " + | ||
"Check the subgraph schema for consistency.", | ||
a.Message); | ||
Assert.Equal("HF0009", a.Code); | ||
}); | ||
} | ||
} |
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