Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using HotChocolate.Adapters.Mcp.Extensions;
using HotChocolate.Types;
using HotChocolate.Types.Descriptors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Text.Json;
using HotChocolate.Adapters.Mcp.Diagnostics;
using HotChocolate.Adapters.Mcp.Extensions;
using HotChocolate.Adapters.Mcp.Storage;
using HotChocolate.Execution.Configuration;
using HotChocolate.Language;
Expand Down Expand Up @@ -28,7 +27,7 @@
await storage.AddOrUpdateToolAsync(
new OperationToolDefinition(
Utf8GraphQLParser.Parse("query GetBooks { books { title } }")));
var builder = new WebHostBuilder()

Check warning on line 30 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'WebHostBuilder' is obsolete: 'WebHostBuilder is deprecated in favor of HostBuilder and WebApplicationBuilder. For more information, visit https://aka.ms/aspnet/deprecate/004.' (https://aka.ms/aspnet/deprecate/004)
.ConfigureServices(
services => services
.AddRouting()
Expand All @@ -46,7 +45,7 @@
app => app
.UseRouting()
.UseEndpoints(endpoints => endpoints.MapGraphQLMcp()));
var server = new TestServer(builder);

Check warning on line 48 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'TestServer.TestServer(IWebHostBuilder)' is obsolete: 'IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' (https://aka.ms/aspnet/deprecate/008)
var mcpClient = await CreateMcpClientAsync(server.CreateClient());

// act
Expand All @@ -60,7 +59,7 @@
public void MapGraphQLMcp_Should_Throw_When_AddMcpNotCalled()
{
// arrange
var builder = new WebHostBuilder()

Check warning on line 62 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'WebHostBuilder' is obsolete: 'WebHostBuilder is deprecated in favor of HostBuilder and WebApplicationBuilder. For more information, visit https://aka.ms/aspnet/deprecate/004.' (https://aka.ms/aspnet/deprecate/004)
.ConfigureServices(
services => services
.AddRouting()
Expand All @@ -72,7 +71,7 @@
.UseEndpoints(endpoints => endpoints.MapGraphQLMcp()));

// act
var exception = Assert.Throws<InvalidOperationException>(() => new TestServer(builder));

Check warning on line 74 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'TestServer.TestServer(IWebHostBuilder)' is obsolete: 'IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' (https://aka.ms/aspnet/deprecate/008)

// assert
Assert.Equal(
Expand All @@ -90,7 +89,7 @@
Utf8GraphQLParser.Parse(
await File.ReadAllTextAsync("__resources__/GetSingleField.graphql"))));
var typeModule = new TestTypeModule();
var builder = new WebHostBuilder()

Check warning on line 92 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'WebHostBuilder' is obsolete: 'WebHostBuilder is deprecated in favor of HostBuilder and WebApplicationBuilder. For more information, visit https://aka.ms/aspnet/deprecate/004.' (https://aka.ms/aspnet/deprecate/004)
.ConfigureServices(
services => services
.AddRouting()
Expand All @@ -102,7 +101,7 @@
app => app
.UseRouting()
.UseEndpoints(endpoints => endpoints.MapGraphQLMcp()));
var server = new TestServer(builder);

Check warning on line 104 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/CoreIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'TestServer.TestServer(IWebHostBuilder)' is obsolete: 'IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' (https://aka.ms/aspnet/deprecate/008)
var mcpClient1 = await CreateMcpClientAsync(server.CreateClient());
var mcpClient2 = await CreateMcpClientAsync(server.CreateClient());
var listChangedResetEvent1 = new ManualResetEventSlim(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Buffers;
using System.Text.Json;
using HotChocolate.Adapters.Mcp.Diagnostics;
using HotChocolate.Adapters.Mcp.Extensions;
using HotChocolate.Adapters.Mcp.Storage;
using HotChocolate.Buffers;
using HotChocolate.Execution;
Expand Down Expand Up @@ -48,7 +47,7 @@
schema.ToSyntaxNode(),
new JsonDocumentOwner(JsonDocument.Parse("{ }"), new EmptyMemoryOwner()));
var configProvider = new TestFusionConfigurationProvider(initialConfig);
var builder = new WebHostBuilder()

Check warning on line 50 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/FusionIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'WebHostBuilder' is obsolete: 'WebHostBuilder is deprecated in favor of HostBuilder and WebApplicationBuilder. For more information, visit https://aka.ms/aspnet/deprecate/004.' (https://aka.ms/aspnet/deprecate/004)
.ConfigureServices(
services => services
.AddRouting()
Expand All @@ -60,7 +59,7 @@
app => app
.UseRouting()
.UseEndpoints(endpoints => endpoints.MapGraphQLMcp()));
var server = new TestServer(builder);

Check warning on line 62 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/FusionIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'TestServer.TestServer(IWebHostBuilder)' is obsolete: 'IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' (https://aka.ms/aspnet/deprecate/008)
var mcpClient1 = await CreateMcpClientAsync(server.CreateClient());
var mcpClient2 = await CreateMcpClientAsync(server.CreateClient());
var listChangedResetEvent1 = new ManualResetEventSlim(false);
Expand Down Expand Up @@ -133,7 +132,7 @@
new CompositionLog());
var result = schemaComposer.Compose();

var builder = new WebHostBuilder()

Check warning on line 135 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/FusionIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'WebHostBuilder' is obsolete: 'WebHostBuilder is deprecated in favor of HostBuilder and WebApplicationBuilder. For more information, visit https://aka.ms/aspnet/deprecate/004.' (https://aka.ms/aspnet/deprecate/004)
.ConfigureServices(
services =>
{
Expand Down Expand Up @@ -171,7 +170,7 @@
.UseAuthentication()
.UseEndpoints(endpoints => endpoints.MapGraphQLMcp()));

return new TestServer(builder);

Check warning on line 173 in src/HotChocolate/Adapters/test/Adapters.Mcp.Tests/FusionIntegrationTests.cs

View workflow job for this annotation

GitHub Actions / Run HotChocolate.Adapters.Mcp.Tests

'TestServer.TestServer(IWebHostBuilder)' is obsolete: 'IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' (https://aka.ms/aspnet/deprecate/008)
}

private static TestServer CreateSubgraph(ITypeDefinition[]? additionalTypes)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using HotChocolate.Adapters.Mcp.Extensions;
using HotChocolate.Adapters.Mcp.Storage;
using HotChocolate.Execution;
using HotChocolate.Language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using HotChocolate.Execution;
using HotChocolate.Types;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using HotChocolate.Execution;
using HotChocolate.Types;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public sealed class SchemaFormatterOptions

/// <summary>
/// Controls whether directive definitions and applied directives whose
/// definition has <see cref="HotChocolate.Types.IDirectiveDefinition.IsPublic"/>
/// definition has <see cref="Types.IDirectiveDefinition.IsPublic"/>
/// set to <c>false</c> are included in the output.
/// Default: <c>true</c>.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ protected override void OnComplete()
EnrichServerAttributes();

string? operationTypeValue = null;
string? operationName = null;
if (TryGetOperationInfo(out var operationType, out operationName))
if (TryGetOperationInfo(out var operationType, out var operationName))
{
operationTypeValue = GraphQL.Operation.TypeValues[operationType];
Activity.DisplayName = operationTypeValue;
Expand Down Expand Up @@ -103,18 +102,18 @@ private void EnrichServerAttributes()
}

if (!string.IsNullOrEmpty(request.Host.Host)
&& Activity.GetTagItem(SemanticConventions.Server.Address) is null)
&& Activity.GetTagItem(Server.Address) is null)
{
Activity.SetTag(SemanticConventions.Server.Address, request.Host.Host);
Activity.SetTag(Server.Address, request.Host.Host);
}

if (request.Host.Port is { } port
&& Activity.GetTagItem(SemanticConventions.Server.Port) is null)
&& Activity.GetTagItem(Server.Port) is null)
{
var defaultPort = request.IsHttps ? 443 : 80;
if (port != defaultPort)
{
Activity.SetTag(SemanticConventions.Server.Port, port);
Activity.SetTag(Server.Port, port);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using HotChocolate.Features;
using HotChocolate.Fusion.Execution;

// ReSharper disable once CheckNamespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ ScopeState ScopeStateFor(ParentPlanContext scope)
return enclosingState;
}

if (rootScopeState is null)
{
rootScopeState = new ScopeState(scope.ParentSteps, scope.ParentInternalOperation);
}
rootScopeState ??= new ScopeState(scope.ParentSteps, scope.ParentInternalOperation);
return rootScopeState;
}

Expand Down Expand Up @@ -578,8 +575,8 @@ private static bool TryLocateInternalSelectionSetAtPath(
var promotedStep = providerStep with
{
Id = newParentStepId,
Dependents = ImmutableHashSet<int>.Empty,
ParentDependencies = ImmutableHashSet<ParentStepRef>.Empty,
Dependents = [],
ParentDependencies = [],
SelectionSets = SelectionSetIndexer.CreateIdSet(providerStep.Definition.SelectionSet, index),
RootSelectionSetId = index.GetId(providerStep.Definition.SelectionSet)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using HotChocolate.Fusion.Options;
using HotChocolate.Serialization;
using HotChocolate.Types.Mutable;
using HotChocolate.Types.Mutable.Serialization;
using static HotChocolate.Fusion.CompositionTestHelper;

namespace HotChocolate.Fusion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using HotChocolate.Fusion.Options;
using HotChocolate.Serialization;
using HotChocolate.Types.Mutable;
using HotChocolate.Types.Mutable.Serialization;
using static HotChocolate.Fusion.CompositionTestHelper;
using static HotChocolate.Fusion.WellKnownTypeNames;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using HotChocolate.Fusion.Logging;
using HotChocolate.Fusion.Options;
using HotChocolate.Fusion.Types;
using HotChocolate.Language;

namespace HotChocolate.Fusion.Configuration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.Immutable;
using System.Text.Json;
using HotChocolate.Execution;
using HotChocolate.Fusion.Execution.Nodes;
Expand Down Expand Up @@ -254,7 +253,7 @@ type Query {
.BuildServiceProvider();

var executor = await services.GetRequestExecutorAsync();
var schema = (HotChocolate.Fusion.Types.FusionSchemaDefinition)executor.Schema;
var schema = (Fusion.Types.FusionSchemaDefinition)executor.Schema;
var operationPlan = PlanOperation(
schema,
"""
Expand Down Expand Up @@ -325,7 +324,7 @@ public void SetRequirements(
_stores.Add(sourceStore);

var entry = sourceStore.CreateVariableValueSets(CompactPath.Root, fields);
context.SetRequirements(ImmutableArray.Create(entry), keys);
context.SetRequirements([entry], keys);
}

public async ValueTask DisposeAsync()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Collections.Immutable;
using System.Text.Json;
using HotChocolate.Execution;
using HotChocolate.Fusion.Execution.Nodes;
Expand Down Expand Up @@ -282,7 +281,7 @@ public void CreateVariableValueSetsFromSnapshot_Should_ReturnEmpty_When_Imported

// act
var result = target.CreateVariableValueSetsFromSnapshot(
ImmutableArray<VariableValues>.Empty,
[],
ImportedKeys("__fusion_1_id"),
[],
[Requirement("__fusion_1_id")]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using CookieCrumble;

namespace HotChocolate.Language.SyntaxTree.Utilities.PrettierParity;

public class PrettierParityTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void GetChangeToken_Should_ThrowObjectDisposedException_When_Disposed()
topology.Dispose();

// act & assert
Assert.Throws<ObjectDisposedException>(() => topology.GetChangeToken());
Assert.Throws<ObjectDisposedException>(topology.GetChangeToken);
}

[Fact]
Expand Down Expand Up @@ -304,7 +304,7 @@ public void Dispose_Should_NotThrow_When_CalledMultipleTimes()

// act
topology.Dispose();
var exception = Record.Exception(() => topology.Dispose());
var exception = Record.Exception(topology.Dispose);

// assert
Assert.Null(exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public abstract class CommandTestBase
protected readonly Mock<IEnvironmentsClient> EnvironmentsClientMock = new(MockBehavior.Strict);
protected readonly Mock<IStagesClient> StagesClientMock = new(MockBehavior.Strict);
internal readonly Mock<Services.Sessions.ISessionService> _sessionServiceMock = new();
internal readonly Mock<IBrowserLauncher> BrowserLauncherMock = new();
internal readonly Mock<IBrowserLauncher> _browserLauncherMock = new();
protected readonly Mock<IWorkspacesClient> WorkspacesClientMock = new(MockBehavior.Strict);
private InteractionMode _interactionMode = InteractionMode.NonInteractive;
private bool _authenticated = true;
Expand Down Expand Up @@ -226,7 +226,7 @@ private ServiceProvider BuildServices(INitroConsole console)
services.Replace(ServiceDescriptor.Singleton(_fileSystemMock.Object));
services.Replace(ServiceDescriptor.Singleton(_environmentVariableProviderMock.Object));
services.Replace(ServiceDescriptor.Singleton(_sessionServiceMock.Object));
services.Replace(ServiceDescriptor.Singleton(BrowserLauncherMock.Object));
services.Replace(ServiceDescriptor.Singleton(_browserLauncherMock.Object));
services.Replace(ServiceDescriptor.Singleton(WorkspacesClientMock.Object));
services.Replace(ServiceDescriptor.Singleton(SchemasClientMock.Object));
services.Replace(ServiceDescriptor.Singleton(FusionConfigurationClientMock.Object));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ public sealed class FusionComposeCommandTests(NitroCommandFixture fixture)
private static readonly string s_validExample1CompositeSchema =
File.ReadAllText("__resources__/valid-example-1-result/composite-schema.graphqls");

private static readonly string s_invalidExample1CompositeSchema =
File.ReadAllText("__resources__/invalid-example-1-result/composite-schema.graphqls");

private static readonly string s_validExcludeByTagCompositeSchema =
File.ReadAllText("__resources__/valid-exclude-by-tag-result/composite-schema.graphqls");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task NoSession_OpensDefaultNitroWebUrl()

// assert
Assert.Equal(0, result.ExitCode);
BrowserLauncherMock.Verify(x => x.Open(Constants.NitroWebUrl), Times.Once);
_browserLauncherMock.Verify(x => x.Open(Constants.NitroWebUrl), Times.Once);
}

[Fact]
Expand All @@ -56,7 +56,7 @@ public async Task DefaultApiUrl_OpensDefaultNitroWebUrl()

// assert
Assert.Equal(0, result.ExitCode);
BrowserLauncherMock.Verify(x => x.Open(Constants.NitroWebUrl), Times.Once);
_browserLauncherMock.Verify(x => x.Open(Constants.NitroWebUrl), Times.Once);
}

[Fact]
Expand All @@ -73,7 +73,7 @@ public async Task CustomApiUrl_OpensBaseUrlSlashUi()

// assert
Assert.Equal(0, result.ExitCode);
BrowserLauncherMock.Verify(x => x.Open("https://api.custom.com/ui"), Times.Once);
_browserLauncherMock.Verify(x => x.Open("https://api.custom.com/ui"), Times.Once);
}

[Fact]
Expand All @@ -90,6 +90,6 @@ public async Task CustomApiUrlWithScheme_OpensBaseUrlSlashUi()

// assert
Assert.Equal(0, result.ExitCode);
BrowserLauncherMock.Verify(x => x.Open("https://api.custom.com/ui"), Times.Once);
_browserLauncherMock.Verify(x => x.Open("https://api.custom.com/ui"), Times.Once);
}
}

This file was deleted.

Loading