Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the need to declare scalars when doing schema stitching (#4769)
- Loading branch information
1 parent
ce3e167
commit 57d1824
Showing
225 changed files
with
15,616 additions
and
14,785 deletions.
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
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
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
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
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
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,8 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\'))" /> | ||
|
||
<PropertyGroup> | ||
<LibraryTargetFrameworks Condition="'$(IsMacOsArm)' == 'true'">net6.0</LibraryTargetFrameworks> | ||
</PropertyGroup> | ||
|
||
</Project> |
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
dotnet format src/Stitching | ||
dotnet format src/Stitching.Abstractions | ||
dotnet format src/Stitching.Redis | ||
dotnet format test/Stitching.Tests |
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
51 changes: 25 additions & 26 deletions
51
...g.Redis/DependencyInjection/HotChocolateStitchingRedisRequestExecutorBuilderExtensions.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 |
---|---|---|
@@ -1,42 +1,41 @@ | ||
using System; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
using HotChocolate; | ||
using HotChocolate.Execution.Configuration; | ||
using HotChocolate.Stitching.Redis; | ||
using HotChocolate.Stitching.Requests; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
using StackExchange.Redis; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection | ||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class HotChocolateStitchingRedisRequestExecutorBuilderExtensions | ||
{ | ||
public static class HotChocolateStitchingRedisRequestExecutorBuilderExtensions | ||
public static IRequestExecutorBuilder AddRemoteSchemasFromRedis( | ||
this IRequestExecutorBuilder builder, | ||
NameString configurationName, | ||
Func<IServiceProvider, IConnectionMultiplexer> connectionFactory) | ||
{ | ||
public static IRequestExecutorBuilder AddRemoteSchemasFromRedis( | ||
this IRequestExecutorBuilder builder, | ||
NameString configurationName, | ||
Func<IServiceProvider, IConnectionMultiplexer> connectionFactory) | ||
if (connectionFactory is null) | ||
{ | ||
if (connectionFactory is null) | ||
{ | ||
throw new ArgumentNullException(nameof(connectionFactory)); | ||
} | ||
throw new ArgumentNullException(nameof(connectionFactory)); | ||
} | ||
|
||
configurationName.EnsureNotEmpty(nameof(configurationName)); | ||
configurationName.EnsureNotEmpty(nameof(configurationName)); | ||
|
||
builder.Services.AddSingleton<IRequestExecutorOptionsProvider>(sp => | ||
{ | ||
IConnectionMultiplexer connection = connectionFactory(sp); | ||
IDatabase database = connection.GetDatabase(); | ||
ISubscriber subscriber = connection.GetSubscriber(); | ||
return new RedisExecutorOptionsProvider( | ||
builder.Name, configurationName, database, subscriber); | ||
}); | ||
builder.Services.AddSingleton<IRequestExecutorOptionsProvider>(sp => | ||
{ | ||
IConnectionMultiplexer connection = connectionFactory(sp); | ||
IDatabase database = connection.GetDatabase(); | ||
ISubscriber subscriber = connection.GetSubscriber(); | ||
return new RedisExecutorOptionsProvider( | ||
builder.Name, configurationName, database, subscriber); | ||
}); | ||
|
||
// Last but not least, we will setup the stitching context which will | ||
// provide access to the remote executors which in turn use the just configured | ||
// request executor proxies to send requests to the downstream services. | ||
builder.Services.TryAddScoped<IStitchingContext, StitchingContext>(); | ||
// Last but not least, we will setup the stitching context which will | ||
// provide access to the remote executors which in turn use the just configured | ||
// request executor proxies to send requests to the downstream services. | ||
builder.Services.TryAddScoped<IStitchingContext, StitchingContext>(); | ||
|
||
return builder; | ||
} | ||
return builder; | ||
} | ||
} |
Oops, something went wrong.