Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
2e76ee5
Add: Mutable composite JSON document
michaelstaib Sep 5, 2025
95f8086
Initial metadb
michaelstaib Sep 5, 2025
4808b63
wip
michaelstaib Sep 5, 2025
25b63d4
copied over json element
michaelstaib Sep 5, 2025
85253c5
fix
michaelstaib Sep 5, 2025
742dade
wip
michaelstaib Sep 5, 2025
00973c3
wip
michaelstaib Sep 5, 2025
415d22a
wip
michaelstaib Sep 5, 2025
dfb3d69
Merge branch 'main' into mst/composite-json
michaelstaib Sep 15, 2025
23c47ec
Some edits
michaelstaib Sep 15, 2025
077d149
Added more stuff :)
michaelstaib Sep 16, 2025
5597236
Added more stuff :)
michaelstaib Sep 16, 2025
bd82d18
Added more stuff :)
michaelstaib Sep 17, 2025
a6232f7
Make it compile
michaelstaib Sep 17, 2025
8bb8b56
Added more tests
michaelstaib Sep 17, 2025
36191f3
Added more tests
michaelstaib Sep 17, 2025
e79e992
Started work on the source result documents
michaelstaib Sep 18, 2025
5b8ff3c
More stuff
michaelstaib Sep 18, 2025
a30d8b2
Added notes
michaelstaib Sep 18, 2025
4dd80eb
More stuff
michaelstaib Sep 19, 2025
b285bcf
More stuff
michaelstaib Sep 19, 2025
3717442
Merge branch 'main' into mst/composite-json
michaelstaib Sep 19, 2025
a312a4c
more stuff
michaelstaib Sep 23, 2025
e2f1915
Merge branch 'main' into mst/composite-json
michaelstaib Sep 23, 2025
c0965ae
more stuff
michaelstaib Sep 23, 2025
ebb5157
more stuff
michaelstaib Sep 23, 2025
b24cd85
more stuff
michaelstaib Sep 23, 2025
7440a51
more stuff
michaelstaib Sep 23, 2025
59710e3
more stuff
michaelstaib Sep 23, 2025
840311b
more stuff
michaelstaib Sep 23, 2025
d04ef74
more stuff
michaelstaib Sep 23, 2025
b79b6f2
more stuff
michaelstaib Sep 23, 2025
1c92a42
more stuff
michaelstaib Sep 23, 2025
c0e287d
more stuff
michaelstaib Sep 23, 2025
c8337de
more stuff
michaelstaib Sep 24, 2025
7431453
more stuff
michaelstaib Sep 24, 2025
f9622c5
more stuff
michaelstaib Sep 24, 2025
bd7cfcc
Make it compile
michaelstaib Sep 24, 2025
0a91e3d
Add more tests
michaelstaib Sep 24, 2025
f32b946
Fixed issue in TryGetProperty
michaelstaib Sep 24, 2025
44a1ab2
Added more tests
michaelstaib Sep 24, 2025
1456d34
Added more tests for the SourceResultDocument
michaelstaib Sep 26, 2025
e4e11f9
Added more tests for the SourceResultDocument
michaelstaib Sep 26, 2025
f2379a2
Added more composite tests
michaelstaib Oct 1, 2025
40d7023
Added more composite tests
michaelstaib Oct 1, 2025
462f05d
Fixed issues and added more tests
michaelstaib Oct 1, 2025
1127317
Reworked the transport to use pipewriter only
michaelstaib Oct 1, 2025
ad9a02b
Fixed writer
michaelstaib Oct 3, 2025
4488324
Fixed more test issues
michaelstaib Oct 3, 2025
90ed421
Introduced FixedSizeArrayPool
michaelstaib Oct 4, 2025
c52cccd
wip
michaelstaib Oct 4, 2025
260c67a
Added benchmarks
michaelstaib Oct 5, 2025
1fe19f5
CLeanup
michaelstaib Oct 5, 2025
fa507b3
More refactoring
michaelstaib Oct 5, 2025
d9c4a6a
More refactoring
michaelstaib Oct 5, 2025
2da42f2
Reworked composite result document.
michaelstaib Oct 6, 2025
d0ba097
Fixed multiple issues
michaelstaib Oct 6, 2025
2c3a0e5
Fixed more propagation issues
michaelstaib Oct 6, 2025
95fc952
Fixed more issues with the null propagation
michaelstaib Oct 7, 2025
87bc3ba
Started work to reconcile the introspection
michaelstaib Oct 8, 2025
0e5998a
Fixed introspection
michaelstaib Oct 9, 2025
23151c6
Merge branch 'main' into mst/composite-json
michaelstaib Oct 9, 2025
2408c8f
Fixed AzureFunction
michaelstaib Oct 9, 2025
0244dc5
Fixed sse tests
michaelstaib Oct 10, 2025
85b1c49
fixed warning
michaelstaib Oct 10, 2025
f0a6357
cleanup
michaelstaib Oct 10, 2025
f396757
Merge branch 'main' into mst/composite-json
michaelstaib Oct 10, 2025
54cf0a0
cleanup
michaelstaib Oct 10, 2025
d9be67a
Fixed array length helper.
michaelstaib Oct 10, 2025
de172a9
Fixed more issues
michaelstaib Oct 10, 2025
b17ff23
Improved property lookup performance
michaelstaib Oct 10, 2025
c03f24a
Improved raw result
michaelstaib Oct 10, 2025
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
19 changes: 15 additions & 4 deletions src/All.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<Project Path="HotChocolate/AspNetCore/src/Transport.Sockets.Client/HotChocolate.Transport.Sockets.Client.csproj" />
<Project Path="HotChocolate/AspNetCore/src/Transport.Sockets/HotChocolate.Transport.Sockets.csproj" />
</Folder>
<Folder Name="/HotChocolate/AspNetCore/src/AspNetCore/" />
<Folder Name="/HotChocolate/AspNetCore/test/">
<Project Path="HotChocolate/AspNetCore/test/AspNetCore.Authorization.Opa.Tests/HotChocolate.AspNetCore.Authorization.Opa.Tests.csproj" />
<Project Path="HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/HotChocolate.AspNetCore.Authorization.Tests.csproj" />
Expand Down Expand Up @@ -175,6 +174,9 @@
<Project Path="HotChocolate/Diagnostics/test/Diagnostics.Tests/HotChocolate.Diagnostics.Tests.csproj" />
</Folder>
<Folder Name="/HotChocolate/Fusion-vnext/" />
<Folder Name="/HotChocolate/Fusion-vnext/benchmarks/">
<Project Path="HotChocolate/Fusion-vnext/benchmarks/Fusion.Execution.Benchmarks/Fusion.Execution.Benchmarks.csproj" />
</Folder>
<Folder Name="/HotChocolate/Fusion-vnext/src/">
<Project Path="HotChocolate/Fusion-vnext/src/Fusion.Aspire/HotChocolate.Fusion.Aspire.csproj" />
<Project Path="HotChocolate/Fusion-vnext/src/Fusion.AspNetCore/HotChocolate.Fusion.AspNetCore.csproj" />
Expand All @@ -188,13 +190,22 @@
<Folder Name="/HotChocolate/Fusion-vnext/test/">
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.AspNetCore.Tests/HotChocolate.Fusion.AspNetCore.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Composition.Tests/HotChocolate.Fusion.Composition.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Execution.Tests/HotChocolate.Fusion.Execution.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.EventSources.Tests/HotChocolate.Fusion.EventSources.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Execution.Tests/HotChocolate.Fusion.Execution.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Language.Tests/HotChocolate.Fusion.Language.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Packaging.Tests/HotChocolate.Fusion.Packaging.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Utilities.Tests/HotChocolate.Fusion.Utilities.Tests.csproj" />
<Project Path="HotChocolate/Fusion-vnext/test/Fusion.Tests.Shared/HotChocolate.Fusion.Tests.Shared.csproj" />
</Folder>
<Folder Name="/HotChocolate/Json/" />
<Folder Name="/HotChocolate/Json/src/" />
<Folder Name="/HotChocolate/Json/src/Json/">
<Project Path="HotChocolate/Json/src/Json/HotChocolate.Text.Json.csproj" />
</Folder>
<Folder Name="/HotChocolate/Json/test/" />
<Folder Name="/HotChocolate/Json/test/Json.Tests/">
<Project Path="HotChocolate/Json/test/Json.Tests/HotChocolate.Text.Json.Tests.csproj" />
</Folder>
<Folder Name="/HotChocolate/Language/" />
<Folder Name="/HotChocolate/Language/src/">
<Project Path="HotChocolate/Language/src/Language.SyntaxTree/HotChocolate.Language.SyntaxTree.csproj" />
Expand Down Expand Up @@ -288,12 +299,12 @@
</Folder>
<Folder Name="/HotChocolate/Utilities/" />
<Folder Name="/HotChocolate/Utilities/src/">
<Project Path="HotChocolate/Utilities/src/Utilities.Base36/HotChocolate.Utilities.Base36.csproj" />
<Project Path="HotChocolate/Utilities/src/Utilities.Buffers/HotChocolate.Utilities.Buffers.csproj" />
<Project Path="HotChocolate/Utilities/src/Utilities.DependencyInjection/HotChocolate.Utilities.DependencyInjection.csproj" />
<Project Path="HotChocolate/Utilities/src/Utilities.Introspection/HotChocolate.Utilities.Introspection.csproj" />
<Project Path="HotChocolate/Utilities/src/Utilities.Tasks/HotChocolate.Utilities.Tasks.csproj" />
<Project Path="HotChocolate/Utilities/src/Utilities/HotChocolate.Utilities.csproj" />
<Project Path="HotChocolate/Utilities/src/Utilities.Base36/HotChocolate.Utilities.Base36.csproj" />
</Folder>
<Folder Name="/HotChocolate/Utilities/test/">
<Project Path="HotChocolate/Utilities/test/Utilities.Introspection.Tests/HotChocolate.Utilities.Introspection.Tests.csproj" />
Expand Down Expand Up @@ -353,4 +364,4 @@
<Folder Name="/StrawberryShake/Tooling/test/">
<Project Path="StrawberryShake/Tooling/test/Configuration.Tests/StrawberryShake.Tools.Configuration.Tests.csproj" />
</Folder>
</Solution>
</Solution>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public static bool IncludeOperationPlan(this HttpContext context)
return false;
}

// TODO : Implement this
public static string? TryGetCostSwitch(this HttpContext context)
{
var headers = context.Request.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private async ValueTask FormatInternalAsync(

OnWriteResponseHeaders(operationResult, format, response.Headers);

await format.Formatter.FormatAsync(result, response.Body, cancellationToken);
await format.Formatter.FormatAsync(result, response.BodyWriter, cancellationToken);
break;
}

Expand All @@ -238,7 +238,7 @@ private async ValueTask FormatInternalAsync(
OnWriteResponseHeaders(resultBatch, format, response.Headers);
await response.Body.FlushAsync(cancellationToken);

await format.Formatter.FormatAsync(result, response.Body, cancellationToken);
await format.Formatter.FormatAsync(result, response.BodyWriter, cancellationToken);
break;
}

Expand All @@ -252,7 +252,7 @@ private async ValueTask FormatInternalAsync(
OnWriteResponseHeaders(responseStream, format, response.Headers);
await response.Body.FlushAsync(cancellationToken);

await format.Formatter.FormatAsync(result, response.Body, cancellationToken);
await format.Formatter.FormatAsync(result, response.BodyWriter, cancellationToken);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ protected override async ValueTask<IReadOnlyList<GraphQLRequest>> ParseRequestsF

// Parse the string values of interest from the IFormCollection
var multipartRequest = ParseMultipartRequest(form);
var requests = session.RequestParser.ParseRequest(
multipartRequest.Operations);
var requests = session.RequestParser.ParseRequest(multipartRequest.Operations);

foreach (var graphQLRequest in requests)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ protected async Task HandleRequestAsync(HttpContext context, ExecutorSession ses
// to the HTTP response stream.
Debug.Assert(result is not null, "No GraphQL result was created.");

if (result is IOperationResult queryResult)
if (result is IOperationResult operationResult)
{
formatScope = session.DiagnosticEvents.FormatHttpResponse(context, queryResult);
formatScope = session.DiagnosticEvents.FormatHttpResponse(context, operationResult);
}

await session.WriteResultAsync(context, result, acceptMediaTypes, statusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<InternalsVisibleTo Include="HotChocolate.Transport.Http" />
<InternalsVisibleTo Include="HotChocolate.Transport.Sockets" />
<InternalsVisibleTo Include="HotChocolate.Transport.Sockets.Client" />
<InternalsVisibleTo Include="HotChocolate.Fusion.Execution" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,31 @@ public sealed class EventStreamResultFormatter(JsonResultFormatterOptions option
/// <summary>
/// Formats an <see cref="IExecutionResult"/> into an SSE stream.
/// </summary>
/// <param name="result"></param>
/// <param name="outputStream"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="NotSupportedException"></exception>
public ValueTask FormatAsync(
IExecutionResult result,
Stream outputStream,
PipeWriter writer,
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(result);
ArgumentNullException.ThrowIfNull(outputStream);
ArgumentNullException.ThrowIfNull(writer);

return result switch
{
IOperationResult operationResult
=> FormatOperationResultAsync(operationResult, outputStream, cancellationToken),
=> FormatOperationResultAsync(operationResult, writer, cancellationToken),
OperationResultBatch resultBatch
=> FormatResultBatchAsync(resultBatch, outputStream, cancellationToken),
=> FormatResultBatchAsync(resultBatch, writer, cancellationToken),
IResponseStream responseStream
=> FormatResponseStreamAsync(responseStream, outputStream, cancellationToken),
=> FormatResponseStreamAsync(responseStream, writer, cancellationToken),
_ => throw new NotSupportedException()
};
}

private async ValueTask FormatOperationResultAsync(
IOperationResult operationResult,
Stream outputStream,
PipeWriter writer,
CancellationToken ct)
{
Exception? exception = null;
var writer = outputStream.CreatePipeWriter();
var scope = Log.FormatOperationResultStart();

try
Expand All @@ -67,24 +59,21 @@ private async ValueTask FormatOperationResultAsync(
catch (Exception ex)
{
scope?.AddError(ex);
exception = ex;
throw;
}
finally
{
scope?.Dispose();
await writer.CompleteAsync(exception).ConfigureAwait(false);
}
}

private async ValueTask FormatResultBatchAsync(
OperationResultBatch resultBatch,
Stream outputStream,
PipeWriter writer,
CancellationToken ct)
{
Exception? exception = null;
using var semaphore = new SemaphoreSlim(1, 1);
var writer = outputStream.CreatePipeWriter();
List<Task>? streams = null;
KeepAliveJob? keepAlive = null;

Expand Down Expand Up @@ -157,8 +146,6 @@ private async ValueTask FormatResultBatchAsync(
{
await TryWriteCompleteAsync(writer, ct).ConfigureAwait(false);
}

await writer.CompleteAsync(exception).ConfigureAwait(false);
}

// we rethrow any stream exception that happened.
Expand All @@ -170,12 +157,11 @@ private async ValueTask FormatResultBatchAsync(

private async ValueTask FormatResponseStreamAsync(
IResponseStream responseStream,
Stream outputStream,
PipeWriter writer,
CancellationToken ct)
{
Exception? exception = null;
using var semaphore = new SemaphoreSlim(1, 1);
var writer = outputStream.CreatePipeWriter();

try
{
Expand Down Expand Up @@ -205,8 +191,6 @@ private async ValueTask FormatResponseStreamAsync(
{
await TryWriteCompleteAsync(writer, ct).ConfigureAwait(false);
}

await writer.CompleteAsync(exception).ConfigureAwait(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,25 @@ public sealed class JsonLinesResultFormatter(JsonResultFormatterOptions options)
{
private readonly JsonResultFormatter _payloadFormatter = new(options with { Indented = false });

/// <summary>
/// Formats an <see cref="IExecutionResult"/> into an JSONL stream.
/// </summary>
public ValueTask FormatAsync(
IExecutionResult result,
Stream outputStream,
PipeWriter writer,
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(result);
ArgumentNullException.ThrowIfNull(outputStream);
ArgumentNullException.ThrowIfNull(writer);

return result switch
{
IOperationResult operationResult
=> FormatOperationResultAsync(operationResult, outputStream, cancellationToken),
=> FormatOperationResultAsync(operationResult, writer, cancellationToken),
OperationResultBatch resultBatch
=> FormatResultBatchAsync(resultBatch, outputStream, cancellationToken),
=> FormatResultBatchAsync(resultBatch, writer, cancellationToken),
IResponseStream responseStream
=> FormatResponseStreamAsync(responseStream, outputStream, cancellationToken),
=> FormatResponseStreamAsync(responseStream, writer, cancellationToken),
_ => throw new NotSupportedException()
};
}
Expand All @@ -35,11 +38,9 @@ IResponseStream responseStream
/// </summary>
private async ValueTask FormatOperationResultAsync(
IOperationResult operationResult,
Stream outputStream,
PipeWriter writer,
CancellationToken ct)
{
Exception? exception = null;
var writer = outputStream.CreatePipeWriter();
var scope = Log.FormatOperationResultStart();

try
Expand All @@ -50,13 +51,11 @@ private async ValueTask FormatOperationResultAsync(
catch (Exception ex)
{
scope?.AddError(ex);
exception = ex;
throw;
}
finally
{
scope?.Dispose();
await writer.CompleteAsync(exception).ConfigureAwait(false);
}
}

Expand All @@ -65,12 +64,11 @@ private async ValueTask FormatOperationResultAsync(
/// </summary>
private async ValueTask FormatResultBatchAsync(
OperationResultBatch resultBatch,
Stream outputStream,
PipeWriter writer,
CancellationToken ct)
{
Exception? exception = null;
using var semaphore = new SemaphoreSlim(1, 1);
var writer = outputStream.CreatePipeWriter();
List<Task>? streams = null;
KeepAliveJob? keepAlive = null;

Expand Down Expand Up @@ -138,7 +136,6 @@ private async ValueTask FormatResultBatchAsync(
var streamError = await TryCompleteStreamsAsync(streams).ConfigureAwait(false);
exception ??= streamError;
keepAlive?.Dispose();
await writer.CompleteAsync(exception).ConfigureAwait(false);
}

// we rethrow any stream exception that happened.
Expand All @@ -150,12 +147,10 @@ private async ValueTask FormatResultBatchAsync(

private async ValueTask FormatResponseStreamAsync(
IResponseStream responseStream,
Stream outputStream,
PipeWriter writer,
CancellationToken ct)
{
Exception? exception = null;
using var semaphore = new SemaphoreSlim(1, 1);
var writer = outputStream.CreatePipeWriter();

try
{
Expand All @@ -167,20 +162,10 @@ private async ValueTask FormatResponseStreamAsync(

await writer.FlushAsync(ct).ConfigureAwait(false);
}
catch (OperationCanceledException ex)
catch (OperationCanceledException)
{
// if the operation was canceled, we do not need to log this
// and will stop gracefully.
exception = ex;
}
catch (Exception ex)
{
exception = ex;
throw;
}
finally
{
await writer.CompleteAsync(exception).ConfigureAwait(false);
}
}

Expand Down
Loading
Loading