diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaType.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaType.cs
index 6c0dcedf5ed..3da9bd852f6 100644
--- a/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaType.cs
+++ b/src/HotChocolate/AspNetCore/src/AspNetCore/AcceptMediaType.cs
@@ -26,7 +26,7 @@ public readonly struct AcceptMediaType
///
/// Type or subtype are empty.
///
- internal AcceptMediaType(
+ public AcceptMediaType(
StringSegment type,
StringSegment subType,
double? quality,
diff --git a/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs b/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs
index d2b0b9d2b20..3684a4560f5 100644
--- a/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs
+++ b/src/HotChocolate/AspNetCore/src/AspNetCore/HeaderUtilities.cs
@@ -11,7 +11,7 @@ namespace HotChocolate.AspNetCore;
///
/// Utilities for handling HTTP headers.
///
-internal static class HeaderUtilities
+public static class HeaderUtilities
{
private static readonly ConcurrentDictionary _cache =
new(StringComparer.Ordinal);
@@ -147,7 +147,7 @@ public CacheEntry(string key, MediaTypeHeaderValue value)
public DateTime CreatedAt { get; }
}
- internal readonly struct AcceptHeaderResult
+ public readonly struct AcceptHeaderResult
{
public AcceptHeaderResult(AcceptMediaType[] acceptMediaTypes)
{
diff --git a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs
index 1be21962d01..882b9ada25c 100644
--- a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs
+++ b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockFunctionContext.cs
@@ -87,7 +87,9 @@ public class MockInvocationFeatures : Dictionary, IInvocationFeatu
public void Set(T instance)
{
if (instance == null)
+ {
return;
+ }
TryAdd(typeof(T), instance);
}
diff --git a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs
index 06d072db584..8e4386d231c 100644
--- a/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs
+++ b/src/HotChocolate/AzureFunctions/test/HotChocolate.AzureFunctions.IsolatedProcess.Tests/Helpers/MockHttpRequestData.cs
@@ -29,8 +29,10 @@ public MockHttpRequestData(
Method = requestHttpMethod ?? throw new ArgumentNullException(nameof(requestHttpMethod));
Url = requestUri ?? throw new ArgumentNullException(nameof(requestUri));
- if(claimsIdentities != null)
+ if (claimsIdentities != null)
+ {
Identities = claimsIdentities;
+ }
if (!string.IsNullOrEmpty(requestBody))
{
diff --git a/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs b/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs
index c3ec461ebcf..3ba9af6138f 100644
--- a/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs
+++ b/src/HotChocolate/Core/src/Types/IReadOnlySchemaOptions.cs
@@ -94,7 +94,7 @@ public interface IReadOnlySchemaOptions
DirectiveVisibility DefaultDirectiveVisibility { get; }
///
- /// Defines that the default resolver execution strategy.
+ /// Defines the default resolver execution strategy.
///
ExecutionStrategy DefaultResolverStrategy { get; }
@@ -102,7 +102,7 @@ public interface IReadOnlySchemaOptions
/// Defines if the order of important middleware components shall be validated.
///
bool ValidatePipelineOrder { get; }
-
+
///
/// Defines if the runtime types of types shall be validated.
///
diff --git a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs
index d4a97173311..483ce5d68bf 100644
--- a/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs
+++ b/src/HotChocolate/Core/src/Types/Types/Introspection/IntrospectionTypeInterceptor.cs
@@ -31,7 +31,7 @@ public override void OnAfterCompleteName(
ITypeCompletionContext completionContext,
DefinitionBase definition)
{
- if(completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef)
+ if (completionContext.Type is ObjectType && definition is ObjectTypeDefinition typeDef)
{
_objectTypeDefinitions.Add(typeDef);
}
diff --git a/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.Constants.cs b/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.Constants.cs
index b284d601887..63d5969cd5f 100644
--- a/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.Constants.cs
+++ b/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.Constants.cs
@@ -5,7 +5,6 @@ namespace HotChocolate.Language;
public ref partial struct Utf8GraphQLRequestParser
{
private const byte _o = (byte)'o';
- private const byte _n = (byte)'n';
private const byte _q = (byte)'q';
private const byte _v = (byte)'v';
private const byte _e = (byte)'e';
@@ -13,82 +12,5 @@ public ref partial struct Utf8GraphQLRequestParser
private const byte _i = (byte)'i';
private const byte _p = (byte)'p';
- // This uses C# compiler's ability to refer to static data directly. For more information see https://vcsjones.dev/2019/02/01/csharp-readonly-span-bytes-static
- private static ReadOnlySpan OperationName => new[]
- {
- (byte)'o',
- (byte)'p',
- (byte)'e',
- (byte)'r',
- (byte)'a',
- (byte)'t',
- (byte)'i',
- (byte)'o',
- (byte)'n',
- (byte)'N',
- (byte)'a',
- (byte)'m',
- (byte)'e',
- };
-
- private static ReadOnlySpan Query => new[]
- {
- (byte)'q',
- (byte)'u',
- (byte)'e',
- (byte)'r',
- (byte)'y',
- };
-
- private static ReadOnlySpan Variables => new[]
- {
- (byte)'v',
- (byte)'a',
- (byte)'r',
- (byte)'i',
- (byte)'a',
- (byte)'b',
- (byte)'l',
- (byte)'e',
- (byte)'s',
- };
-
- private static ReadOnlySpan Extensions => new[]
- {
- (byte)'e',
- (byte)'x',
- (byte)'t',
- (byte)'e',
- (byte)'n',
- (byte)'s',
- (byte)'i',
- (byte)'o',
- (byte)'n',
- (byte)'s',
- };
-
- private static ReadOnlySpan Type => new[]
- {
- (byte)'t',
- (byte)'y',
- (byte)'p',
- (byte)'e',
- };
-
- private static ReadOnlySpan Id => new[]
- {
- (byte)'i',
- (byte)'d',
- };
-
- private static ReadOnlySpan Payload => new[]
- {
- (byte)'p',
- (byte)'a',
- (byte)'y',
- (byte)'l',
- (byte)'o',
- (byte)'a',
- (byte)'d',
- };
+ private static ReadOnlySpan Id => "id"u8;
}
diff --git a/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.cs b/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.cs
index 8000322873b..6eb3339f903 100644
--- a/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.cs
+++ b/src/HotChocolate/Language/src/Language.Web/Utf8GraphQLRequestParser.cs
@@ -142,7 +142,7 @@ private void ParseRequestProperty(ref Request request)
switch (fieldName[0])
{
case _o:
- if (fieldName.SequenceEqual(OperationName))
+ if (fieldName.SequenceEqual("operationName"u8))
{
request.OperationName = ParseStringOrNull();
}
@@ -156,7 +156,7 @@ private void ParseRequestProperty(ref Request request)
break;
case _q:
- if (fieldName.SequenceEqual(Query))
+ if (fieldName.SequenceEqual("query"u8))
{
request.HasQuery = !IsNullToken();
@@ -171,14 +171,14 @@ private void ParseRequestProperty(ref Request request)
break;
case _v:
- if (fieldName.SequenceEqual(Variables))
+ if (fieldName.SequenceEqual("variables"u8))
{
request.Variables = ParseVariables();
}
break;
case _e:
- if (fieldName.SequenceEqual(Extensions))
+ if (fieldName.SequenceEqual("extensions"u8))
{
request.Extensions = ParseObjectOrNull();
}
@@ -198,7 +198,7 @@ private void ParseMessageProperty(ref Message message)
switch (fieldName[0])
{
case _t:
- if (fieldName.SequenceEqual(Type))
+ if (fieldName.SequenceEqual("type"u8))
{
message.Type = ParseStringOrNull();
}
@@ -212,7 +212,7 @@ private void ParseMessageProperty(ref Message message)
break;
case _p:
- if (fieldName.SequenceEqual(Payload))
+ if (fieldName.SequenceEqual("payload"u8))
{
var start = _reader.Start;
var hasPayload = !IsNullToken();
diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs
index 59a8e10773b..367839c6a2b 100644
--- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs
+++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/OpenApiWrapperPipelineBuilder.cs
@@ -11,7 +11,11 @@ private OpenApiWrapperPipelineBuilder()
public OpenApiWrapperDelegate Build()
{
OpenApiWrapperDelegate next = _ => { };
- for (var i = _pipeline.Count - 1; i >= 0; i--) next = _pipeline[i].Invoke(next);
+ for (var i = _pipeline.Count - 1; i >= 0; i--)
+ {
+ next = _pipeline[i].Invoke(next);
+ }
+
return next;
}
diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs
index 11d1ae71d95..3c64bc0e5d1 100644
--- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs
+++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateInputTypesMiddleware.cs
@@ -79,7 +79,11 @@ private static void AddInputType(OpenApiWrapperContext context, Operation operat
private static void AddIfNecessary(OpenApiWrapperContext context, InputObjectType inputObjectType)
{
- if (context.MutableSchema.Types.ContainsName(inputObjectType.Name)) return;
+ if (context.MutableSchema.Types.ContainsName(inputObjectType.Name))
+ {
+ return;
+ }
+
context.MutableSchema.Types.Add(inputObjectType);
}
diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs
index 9bac554ab20..ab10fe1d5db 100644
--- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs
+++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/CreateMutationTypeMiddleware.cs
@@ -23,7 +23,10 @@ private static void CreateMutationType(OpenApiWrapperContext context)
{
var operations = context.GetMutationOperations();
- if (operations.Count == 0) return;
+ if (operations.Count == 0)
+ {
+ return;
+ }
var mutationType = new ObjectType(OpenApiResources.RootTypeMutation);
diff --git a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs
index 49eb04cad2d..62bc40b4344 100644
--- a/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs
+++ b/src/HotChocolate/OpenApi/src/HotChocolate.OpenApi/Pipeline/DiscoverOperationsMiddleware.cs
@@ -41,7 +41,11 @@ public void Invoke(OpenApiWrapperContext context, OpenApiWrapperDelegate next)
resultOperation.AddParameter(openApiParameter);
}
- if (context.Operations.ContainsKey(resultOperation.OperationId)) continue;
+ if (context.Operations.ContainsKey(resultOperation.OperationId))
+ {
+ continue;
+ }
+
context.Operations.Add(resultOperation.OperationId, resultOperation);
}
}
diff --git a/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs b/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs
index 662a7472bc8..299aeb423f7 100644
--- a/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs
+++ b/src/HotChocolate/OpenApi/tests/HotChocolate.OpenApi.Tests/Controller/PetStoreController.cs
@@ -32,7 +32,11 @@ public IActionResult DeletePet([FromRoute] [Required] long? id)
{
var toDelete = _pets.FirstOrDefault(p => p.Id == id);
- if (toDelete is null) return BadRequest("Pet not found");
+ if (toDelete is null)
+ {
+ return BadRequest("Pet not found");
+ }
+
_pets.Remove(toDelete);
return Ok();
diff --git a/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs b/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs
index 2e0b4c98346..899fc02bd80 100644
--- a/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs
+++ b/src/StrawberryShake/Client/src/Core/Serialization/Iso8601Duration.cs
@@ -305,10 +305,14 @@ internal static bool TryParse(string s, out TimeSpan? result)
// Normalize to nanosecond intervals
for (; numDigits > 9; numDigits--)
+ {
value /= 10;
+ }
for (; numDigits < 9; numDigits++)
+ {
value *= 10;
+ }
nanoseconds |= (uint)value;