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
Expand Up @@ -554,10 +554,7 @@ public void AddPayload(JsonElement root)
{
PayloadCount++;

if (InitialPayload is null)
{
InitialPayload = root.Clone();
}
InitialPayload ??= root.Clone();

if (root.TryGetProperty("pending", out var pending))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ internal static class RequestClassMiddlewareFactory
.GetMethod(nameof(IServiceProvider.GetService))!;

internal static RequestMiddleware Create<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)]
TMiddleware>()
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)] TMiddleware>()
where TMiddleware : class
{
return (context, next) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ namespace HotChocolate;
public static partial class SchemaBuilderExtensions
{
public static ISchemaBuilder Use<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)]
TMiddleware>(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)] TMiddleware>(
this ISchemaBuilder builder)
where TMiddleware : class
{
Expand All @@ -16,8 +15,7 @@ public static ISchemaBuilder Use<
}

public static ISchemaBuilder Use<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)]
TMiddleware>(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)] TMiddleware>(
this ISchemaBuilder builder,
Func<IServiceProvider, FieldDelegate, TMiddleware> factory)
where TMiddleware : class
Expand All @@ -38,8 +36,7 @@ public static ISchemaBuilder Map(
}

public static ISchemaBuilder Map<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)]
TMiddleware>(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)] TMiddleware>(
this ISchemaBuilder builder,
FieldReference fieldReference)
where TMiddleware : class
Expand All @@ -56,8 +53,7 @@ public static ISchemaBuilder Map<
}

public static ISchemaBuilder Map<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)]
TMiddleware>(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods)] TMiddleware>(
this ISchemaBuilder builder,
FieldReference fieldReference,
Func<IServiceProvider, FieldDelegate, TMiddleware> factory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public static class DataLoaderObjectFieldExtensions
{
[RequiresDynamicCode("Creates generic types at runtime for data loader middleware.")]
public static IObjectFieldDescriptor UseDataLoader<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
TDataLoader>(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] TDataLoader>(
this IObjectFieldDescriptor descriptor)
where TDataLoader : IDataLoader
=> UseDataLoader(descriptor, typeof(TDataLoader));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using HotChocolate.Resolvers;
using HotChocolate.Subscriptions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using HotChocolate.Internal;
using HotChocolate.Utilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ public virtual IEnumerable<object> GetEnumValues(Type enumType)

if (enumType != typeof(object) && enumType.IsEnum)
{
// Enum.GetValues requires dynamic code but the enum type
// is schema-registered and guaranteed to be available.
// Enum.GetValues requires dynamic code but the enum type
// is schema-registered and guaranteed to be available.
#pragma warning disable IL3050
return Enum.GetValues(enumType).Cast<object>();
#pragma warning restore IL3050
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ For more details look at the `Errors` property.
1. The provided type HotChocolate.Execution.Integration.DataLoader.UseDataLoaderTests+Foo is not a DataLoader.
(HotChocolate.Types.ObjectType<HotChocolate.Execution.Integration.DataLoader.UseDataLoaderTests.Query>)

at HotChocolate.Types.DataLoaderObjectFieldExtensions.UseDataLoader(IObjectFieldDescriptor descriptor, Type dataLoaderType) in ObjectFieldDataLoaderExtensions.cs:line 33
at HotChocolate.Types.DataLoaderObjectFieldExtensions.UseDataLoader(IObjectFieldDescriptor descriptor, Type dataLoaderType) in ObjectFieldDataLoaderExtensions.cs:line 32
at HotChocolate.Execution.Integration.DataLoader.UseDataLoaderTests.<>c.<UseDataLoader_Should_ThrowException_When_NotADataLoader>b__0_1(IObjectTypeDescriptor`1 x) in UseDataLoaderTests.cs:line 16
at HotChocolate.Types.ObjectType`1.CreateConfiguration(ITypeDiscoveryContext context) in ObjectType~1.cs:line 47
at HotChocolate.Types.TypeSystemObject`1.Initialize(ITypeDiscoveryContext context) in TypeSystemObjectBase~1.cs:line 29
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace HotChocolate.Fusion.ApolloFederation;
/// </summary>
internal static class RemoveFederationInfrastructure
{
private static readonly HashSet<string> _federationDirectiveNames = new(StringComparer.Ordinal)
private static readonly HashSet<string> s_federationDirectiveNames = new(StringComparer.Ordinal)
{
FederationDirectiveNames.Key,
FederationDirectiveNames.Requires,
Expand All @@ -26,7 +26,7 @@ internal static class RemoveFederationInfrastructure
FederationDirectiveNames.Policy
};

private static readonly HashSet<string> _federationScalarNames = new(StringComparer.Ordinal)
private static readonly HashSet<string> s_federationScalarNames = new(StringComparer.Ordinal)
{
FederationTypeNames.Any,
FederationTypeNames.FieldSet,
Expand All @@ -42,13 +42,13 @@ internal static class RemoveFederationInfrastructure
public static void Apply(MutableSchemaDefinition schema)
{
// Remove federation directive definitions.
foreach (var name in _federationDirectiveNames)
foreach (var name in s_federationDirectiveNames)
{
schema.DirectiveDefinitions.Remove(name);
}

// Remove federation scalar types.
foreach (var name in _federationScalarNames)
foreach (var name in s_federationScalarNames)
{
schema.Types.Remove(name);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using HotChocolate.ApolloFederation.Resolvers;
using HotChocolate.ApolloFederation.Types;
using HotChocolate.Language;
using HotChocolate.Types;

namespace HotChocolate.Fusion.Suites.ComplexEntityCall.Products;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace HotChocolate.Fusion.Suites.Fed2ExternalExtends.A;

/// <summary>
/// Root <c>Query</c> type for the <c>a</c> subgraph. Exposes
/// <c>randomUser: User</c> and <c>providedRandomUser: User @provides(fields:
/// "name")</c>. The <c>providedRandomUser</c> path returns a user with the
/// <c>randomUser: User</c> and
/// <c>providedRandomUser: User @provides(fields: "name")</c>.
/// The <c>providedRandomUser</c> path returns a user with the
/// otherwise external <c>name</c> field already populated so the gateway
/// can read <c>name</c> without dispatching a separate entity call to
/// subgraph <c>b</c>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace HotChocolate.Fusion.Suites.Fed2ExternalExtends.A;

/// <summary>
/// Apollo Federation descriptor for the <c>User</c> entity as extended by
/// the <c>a</c> subgraph. Mirrors the audit SDL:
/// <c>type User @key(fields: "id") @extends { id: ID! @external, name:
/// String! @external, rid: ID }</c>. The reference resolver returns the
/// seeded <see cref="User"/> by <c>id</c> so subsequent paths can fetch
/// <c>rid</c>.
/// the <c>a</c> subgraph. Mirrors the audit SDL
/// <c>type User @key(fields: "id") @extends</c> with fields
/// <c>id: ID! @external</c>, <c>name: String! @external</c>, and <c>rid: ID</c>.
/// The reference resolver returns the seeded <see cref="User"/> by
/// <c>id</c> so subsequent paths can fetch <c>rid</c>.
/// </summary>
public sealed class UserType : ObjectType<User>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace HotChocolate.Fusion.Suites.Fed2ExternalExtends.B;

/// <summary>
/// Apollo Federation descriptor for the <c>User</c> entity owned by the
/// <c>b</c> subgraph. Mirrors the audit SDL:
/// <c>type User @key(fields: "id") { id: ID!, name: String! @shareable,
/// nickname: String }</c>. The reference resolver looks up users by
/// <c>id</c>.
/// <c>b</c> subgraph. Mirrors the audit SDL
/// <c>type User @key(fields: "id")</c> with fields
/// <c>id: ID!</c>, <c>name: String! @shareable</c>, and <c>nickname: String</c>.
/// The reference resolver looks up users by <c>id</c>.
/// </summary>
public sealed class UserType : ObjectType<User>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace HotChocolate.Fusion.Suites.Fed2ExternalExtension.A;

/// <summary>
/// Root <c>Query</c> type for the <c>a</c> subgraph. Exposes
/// <c>randomUser: User</c> and <c>providedRandomUser: User @provides(fields:
/// "name")</c>. The <c>providedRandomUser</c> path returns a user with the
/// <c>randomUser: User</c> and
/// <c>providedRandomUser: User @provides(fields: "name")</c>.
/// The <c>providedRandomUser</c> path returns a user with the
/// otherwise external <c>name</c> field already populated so the gateway
/// can read <c>name</c> without dispatching a separate entity call to
/// subgraph <c>b</c>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace HotChocolate.Fusion.Suites.Fed2ExternalExtension.A;

/// <summary>
/// Apollo Federation descriptor for the <c>User</c> entity as projected
/// by the <c>a</c> subgraph. Mirrors the audit SDL:
/// <c>extend type User @key(fields: "id") { id: ID! @external, name:
/// String! @external, rid: ID }</c>. The reference resolver returns the
/// seeded <see cref="User"/> by <c>id</c> so subsequent paths can fetch
/// <c>rid</c>.
/// by the <c>a</c> subgraph. Mirrors the audit SDL
/// <c>extend type User @key(fields: "id")</c> with fields
/// <c>id: ID! @external</c>, <c>name: String! @external</c>, and <c>rid: ID</c>.
/// The reference resolver returns the seeded <see cref="User"/> by
/// <c>id</c> so subsequent paths can fetch <c>rid</c>.
/// </summary>
public sealed class UserType : ObjectType<User>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace HotChocolate.Fusion.Suites.Fed2ExternalExtension.B;

/// <summary>
/// Apollo Federation descriptor for the <c>User</c> entity owned by the
/// <c>b</c> subgraph. Mirrors the audit SDL:
/// <c>type User @key(fields: "id") { id: ID!, name: String! @shareable,
/// nickname: String }</c>. The reference resolver looks up users by
/// <c>id</c>.
/// <c>b</c> subgraph. Mirrors the audit SDL
/// <c>type User @key(fields: "id")</c> with fields
/// <c>id: ID!</c>, <c>name: String! @shareable</c>, and <c>nickname: String</c>.
/// The reference resolver looks up users by <c>id</c>.
/// </summary>
public sealed class UserType : ObjectType<User>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace HotChocolate.Fusion.Suites.SimpleRequiresProvides.Accounts;
/// <summary>
/// Apollo Federation descriptor for the <c>User</c> entity owned by the
/// <c>accounts</c> subgraph. Mirrors the audit Schema Definition Language
/// (SDL): <c>type User @key(fields: "id") { id: ID!, name: String,
/// username: String @shareable }</c>.
/// (SDL) <c>type User @key(fields: "id")</c> with fields
/// <c>id: ID!</c>, <c>name: String</c>, and <c>username: String @shareable</c>.
/// </summary>
public sealed class UserType : ObjectType<User>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace HotChocolate.Fusion.Suites.SimpleRequiresProvides.Products;
/// <summary>
/// Apollo Federation descriptor for the <c>Product</c> entity owned by the
/// <c>products</c> subgraph. Mirrors the audit Schema Definition Language
/// (SDL): <c>type Product @key(fields: "upc") { upc: String!, name: String,
/// price: Int, weight: Int }</c>.
/// (SDL) <c>type Product @key(fields: "upc")</c> with fields
/// <c>upc: String!</c>, <c>name: String</c>, <c>price: Int</c>, and <c>weight: Int</c>.
/// </summary>
public sealed class ProductType : ObjectType<Product>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ namespace HotChocolate.Fusion.Suites.SimpleRequiresProvides.Reviews;
/// <summary>
/// Apollo Federation descriptor for the <c>Review</c> entity owned by the
/// <c>reviews</c> subgraph. Mirrors the audit Schema Definition Language
/// (SDL): <c>type Review @key(fields: "id") { id: ID!, body: String,
/// author: User @provides(fields: "username"), product: Product }</c>.
/// (SDL) <c>type Review @key(fields: "id")</c> with fields
/// <c>id: ID!</c>, <c>body: String</c>,
/// <c>author: User @provides(fields: "username")</c>, and <c>product: Product</c>.
/// The <c>author</c> resolver inlines <c>username</c> alongside the
/// returned <see cref="User"/> so the gateway can satisfy the provides
/// selection without dispatching a fresh entity call to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ public async Task SetLegacyArchiveFile_WithValidContent_RoundTripsCorrectly()
{
// arrange
await using var stream = CreateStream();
var content = Encoding.UTF8.GetBytes("legacy archive payload");
var content = "legacy archive payload"u8.ToArray();
await using var contentStream = new MemoryStream(content);

// act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public async ValueTask PersistAsync(MessageEnvelope envelope, CancellationToken
await connection.OpenAsync(cancellationToken);
}

var transaction = _originalDbContext.Database.CurrentTransaction?.GetDbTransaction() as NpgsqlTransaction;

await using var writer = new Utf8JsonWriter(_arrayWriter);
writer.WriteEnvelope(envelope);
writer.Flush(); // we know it's not async
Expand All @@ -99,7 +97,7 @@ public async ValueTask PersistAsync(MessageEnvelope envelope, CancellationToken

await command.ExecuteNonQueryAsync(cancellationToken);

if (transaction is null)
if (_originalDbContext.Database.CurrentTransaction?.GetDbTransaction() is not NpgsqlTransaction)
{
_signal.Set();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Text;
using System.Text.Json;
using System.Threading.Channels;
using ChilliCream.Nitro.CommandLine.FusionCompatibility;
using ChilliCream.Nitro.CommandLine.Services;
using HotChocolate.Fusion;
using HotChocolate.Fusion.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using ChilliCream.Nitro.Client;
using ChilliCream.Nitro.Client.FusionConfiguration;
using ChilliCream.Nitro.CommandLine.Commands.Fusion.PublishCommand;
using ChilliCream.Nitro.CommandLine.FusionCompatibility;
using ChilliCream.Nitro.CommandLine.Helpers;
using ChilliCream.Nitro.CommandLine.Services;
using ChilliCream.Nitro.CommandLine.Services.Sessions;
Expand Down
Loading
Loading