Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Experimental Support for Aspire #6973

Merged
merged 6 commits into from
Mar 7, 2024
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
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "major"
"version": "8.0.100"
}
}
11 changes: 11 additions & 0 deletions src/HotChocolate/Core/src/Abstractions/SchemaFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using HotChocolate.Language;

namespace HotChocolate;

/// <summary>
/// Implement this interface to enable design-time services to create the GraphQL type system.
/// </summary>
public interface IDesignTimeSchemaDocumentFactory
{
DocumentNode CreateSchemaDocument(string[] args);
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
namespace HotChocolate.Types.Analyzers.Inspectors;

public sealed class DataLoaderDefaultsInfo : ISyntaxInfo, IEquatable<DataLoaderDefaultsInfo>
public sealed class DataLoaderDefaultsInfo(
bool? scoped,
bool? isPublic,
bool? isInterfacePublic,
bool registerServices)
: ISyntaxInfo
, IEquatable<DataLoaderDefaultsInfo>
{
public DataLoaderDefaultsInfo(
bool? scoped,
bool? isPublic,
bool? isInterfacePublic,
bool registerServices)
{
Scoped = scoped;
IsPublic = isPublic;
IsInterfacePublic = isInterfacePublic;
RegisterServices = registerServices;
}

public bool? Scoped { get; }
public bool? Scoped { get; } = scoped;

public bool? IsPublic { get; }
public bool? IsPublic { get; } = isPublic;

public bool? IsInterfacePublic { get; }
public bool? IsInterfacePublic { get; } = isInterfacePublic;

public bool RegisterServices { get; }
public bool RegisterServices { get; } = registerServices;

public bool Equals(DataLoaderDefaultsInfo? other)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ctor is not
var parameterTypeName = parameter.Type.ToFullyQualified();

if (parameterTypeName.Equals("global::HotChocolate.Schema") ||
parameterTypeName.Equals("global::HotChocolate.!Schema"))
parameterTypeName.Equals("global::HotChocolate.ISchema"))
{
kind = RequestMiddlewareParameterKind.Schema;
}
Expand All @@ -108,26 +108,7 @@ ctor is not

invokeParameters.Add(new RequestMiddlewareParameterInfo(kind, parameterTypeName));
}


/*
public static IRequestExecutorBuilder UseRequest<TMiddleware>(
this IRequestExecutorBuilder builder)
where TMiddleware : class

[InterceptsLocation(@"C:\testapp\Program.cs", line: 4, column: 5)]
public static RouteHandlerBuilder InterceptMapGet( // 👈 The interceptor must
this IEndpointRouteBuilder endpoints, // have the same signature
string pattern, // as the method being
Delegate handler) // intercepted
{
Console.WriteLine($"Intercepted '{pattern}'" );

return endpoints.MapGet(pattern, handler);
}
*/



syntaxInfo = new RequestMiddlewareInfo(
middlewareType.Name,
middlewareType.ToFullyQualified(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@

namespace HotChocolate.Types.Factories;

internal class SchemaSyntaxVisitorContext : ISyntaxVisitorContext
internal class SchemaSyntaxVisitorContext(IDescriptorContext directiveContext)
{
public SchemaSyntaxVisitorContext(IDescriptorContext directiveContext)
{
DirectiveContext = directiveContext;
}

public List<TypeReference> Types { get; } = [];

public IReadOnlyCollection<DirectiveNode>? Directives { get; set; }
Expand All @@ -26,5 +21,5 @@ public SchemaSyntaxVisitorContext(IDescriptorContext directiveContext)

public string? Description { get; set; }

public IDescriptorContext DirectiveContext { get; }
public IDescriptorContext DirectiveContext { get; } = directiveContext;
}
9 changes: 2 additions & 7 deletions src/HotChocolate/Core/src/Types/Types/Scalars/JsonType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,9 @@ protected override ISyntaxVisitorAction Enter(
}
}

private sealed class JsonFormatterContext : ISyntaxVisitorContext
private sealed class JsonFormatterContext(Utf8JsonWriter writer)
{
public JsonFormatterContext(Utf8JsonWriter writer)
{
Writer = writer;
}

public Utf8JsonWriter Writer { get; }
public Utf8JsonWriter Writer { get; } = writer;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace HotChocolate.Validation;
/// This interface represents the document validation context that can
/// be used by validation visitors to build up state.
/// </summary>
public interface IDocumentValidatorContext : ISyntaxVisitorContext
public interface IDocumentValidatorContext
{
/// <summary>
/// Gets the schema on which the validation is executed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace HotChocolate.Data.Filters;
/// <summary>
/// A context object that is passed along the visitation cycle
/// </summary>
public interface IFilterVisitorContext : ISyntaxVisitorContext
public interface IFilterVisitorContext
{
/// <summary>
/// The already visited types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ private static void CollectSelectionOfNodes(
SelectionSetOptimizerContext context,
List<ISelectionNode> selections)
{
if (context.Selections.Values.FirstOrDefault(
x => x.Field.Name == "nodes") is { } nodeSelection)
if (context.Selections.Values.FirstOrDefault(x => x.Field.Name == "nodes") is { } nodeSelection)
{
foreach (var nodeField in nodeSelection.SelectionSet!.Selections)
{
Expand All @@ -167,7 +166,7 @@ private static void CollectSelectionOfNodes(
}
}

private static readonly ISyntaxRewriter<ISyntaxVisitorContext> _cloneSelectionSetRewriter =
private static readonly ISyntaxRewriter<object?> _cloneSelectionSetRewriter =
SyntaxRewriter.Create(
n => n.Kind is SyntaxKind.SelectionSet
? new SelectionSetNode(((SelectionSetNode)n).Selections)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;
using HotChocolate.Language.Visitors;
using HotChocolate.Types;

namespace HotChocolate.Data.Sorting;

public interface ISortVisitorContext : ISyntaxVisitorContext
public interface ISortVisitorContext
{
Stack<IType> Types { get; }

Expand Down
14 changes: 14 additions & 0 deletions src/HotChocolate/Fusion/HotChocolate.Fusion.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Command
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.CommandLine.Tests", "test\CommandLine.Tests\HotChocolate.Fusion.CommandLine.Tests.csproj", "{DBD317C2-8485-4A75-8BB7-D70C02B40944}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Composition.Analyzers", "src\Composition.Analyzers\HotChocolate.Fusion.Composition.Analyzers.csproj", "{A939BC1B-93A0-40DC-B336-27FF2BC2F704}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HotChocolate.Fusion.Composition.Analyzers.Tests", "test\Composition.Analyzers.Tests\HotChocolate.Fusion.Composition.Analyzers.Tests.csproj", "{FD460672-8769-4EB8-87E0-A6A9D5C946C7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -70,6 +74,14 @@ Global
{DBD317C2-8485-4A75-8BB7-D70C02B40944}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBD317C2-8485-4A75-8BB7-D70C02B40944}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBD317C2-8485-4A75-8BB7-D70C02B40944}.Release|Any CPU.Build.0 = Release|Any CPU
{A939BC1B-93A0-40DC-B336-27FF2BC2F704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A939BC1B-93A0-40DC-B336-27FF2BC2F704}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A939BC1B-93A0-40DC-B336-27FF2BC2F704}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A939BC1B-93A0-40DC-B336-27FF2BC2F704}.Release|Any CPU.Build.0 = Release|Any CPU
{FD460672-8769-4EB8-87E0-A6A9D5C946C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD460672-8769-4EB8-87E0-A6A9D5C946C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD460672-8769-4EB8-87E0-A6A9D5C946C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD460672-8769-4EB8-87E0-A6A9D5C946C7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0355AF0F-B91D-4852-8C9F-8E13CE5C88F3} = {748FCFC6-3EE7-4CFD-AFB3-B0F7B1ACD026}
Expand All @@ -81,5 +93,7 @@ Global
{0A07E4BB-0CFE-406C-B3F4-E26D0100F6F9} = {0EF9C546-286E-407F-A02E-731804507FDE}
{B4FA97BA-2C36-48F6-ABC4-7088C655E936} = {748FCFC6-3EE7-4CFD-AFB3-B0F7B1ACD026}
{DBD317C2-8485-4A75-8BB7-D70C02B40944} = {0EF9C546-286E-407F-A02E-731804507FDE}
{A939BC1B-93A0-40DC-B336-27FF2BC2F704} = {748FCFC6-3EE7-4CFD-AFB3-B0F7B1ACD026}
{FD460672-8769-4EB8-87E0-A6A9D5C946C7} = {0EF9C546-286E-407F-A02E-731804507FDE}
EndGlobalSection
EndGlobal
15 changes: 4 additions & 11 deletions src/HotChocolate/Fusion/src/CommandLine/Commands/ComposeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,8 @@ private static async Task ResolveSubgraphPackagesAsync(
}
}

private sealed class ConsoleLog : ICompositionLog
private sealed class ConsoleLog(IConsole console) : ICompositionLog
{
private readonly IConsole _console;

public ConsoleLog(IConsole console)
{
_console = console;
}

public bool HasErrors { get; private set; }

public void Write(LogEntry e)
Expand All @@ -300,15 +293,15 @@ public void Write(LogEntry e)

if (e.Code is null)
{
_console.WriteLine($"{e.Severity}: {e.Message}");
console.WriteLine($"{e.Severity}: {e.Message}");
}
else if (e.Coordinate is null)
{
_console.WriteLine($"{e.Severity}: {e.Code} {e.Message}");
console.WriteLine($"{e.Severity}: {e.Code} {e.Message}");
}
else
{
_console.WriteLine($"{e.Severity}: {e.Code} {e.Message} {e.Coordinate}");
console.WriteLine($"{e.Severity}: {e.Code} {e.Message} {e.Coordinate}");
}
}
}
Expand Down
Loading
Loading