Skip to content

Commit e2d2300

Browse files
authored
Skimmed Schema Improvements for Fusion (#7167)
1 parent 41dee1d commit e2d2300

File tree

190 files changed

+5302
-2342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+5302
-2342
lines changed

.build/Helpers.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static class Helpers
2525
Path.Combine("HotChocolate", "Marten"),
2626
Path.Combine("HotChocolate", "MongoDb"),
2727
Path.Combine("HotChocolate", "OpenApi"),
28+
Path.Combine("HotChocolate", "Primitives"),
2829
Path.Combine("HotChocolate", "Raven"),
2930
Path.Combine("HotChocolate", "Skimmed"),
3031
Path.Combine("HotChocolate", "Fusion"),

src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434
<ProjectReference Include="..\..\..\HotChocolate\AspNetCore\src\Transport.Abstractions\HotChocolate.Transport.Abstractions.csproj" />
3535
</ItemGroup>
3636

37-
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' OR '$(TargetFramework)' == 'net8.0'">
37+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
3838
<ProjectReference Include="..\..\..\HotChocolate\Fusion\src\Core\HotChocolate.Fusion.csproj" />
39-
<ProjectReference Include="..\..\..\HotChocolate\Skimmed\src\Skimmed\Skimmed.csproj" />
4039
</ItemGroup>
4140

4241
</Project>

src/CookieCrumble/src/CookieCrumble/Formatters/QueryPlanSnapshotValueFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET7_0_OR_GREATER
1+
#if NET8_0_OR_GREATER
22
using System.Buffers;
33
using HotChocolate.Fusion.Execution.Nodes;
44

src/CookieCrumble/src/CookieCrumble/Formatters/SkimmedSchemaSnapshotValueFormatter.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/CookieCrumble/src/CookieCrumble/LocalFactDiscoverer.cs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,29 @@ namespace CookieCrumble;
77
[XunitTestCaseDiscoverer("LocalFactDiscoverer", "YourTestAssemblyName")]
88
public class LocalFactAttribute : FactAttribute;
99

10-
public class LocalFactDiscoverer : FactDiscoverer
10+
public class LocalFactDiscoverer(IMessageSink diagnosticMessageSink) : FactDiscoverer(diagnosticMessageSink)
1111
{
12-
private readonly IMessageSink _diagnosticMessageSink;
12+
private readonly IMessageSink _diagnosticMessageSink = diagnosticMessageSink;
1313

14-
public LocalFactDiscoverer(IMessageSink diagnosticMessageSink) : base(diagnosticMessageSink)
15-
{
16-
_diagnosticMessageSink = diagnosticMessageSink;
17-
}
18-
19-
20-
protected override IXunitTestCase CreateTestCase(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
14+
protected override IXunitTestCase CreateTestCase(
15+
ITestFrameworkDiscoveryOptions discoveryOptions,
16+
ITestMethod testMethod,
17+
IAttributeInfo factAttribute)
2118
{
2219
if (TestEnvironment.IsLocalEnvironment())
2320
{
24-
return new XunitTestCase(_diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod);
25-
}
26-
else
27-
{
28-
return new ExecutionErrorTestCase(_diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod, "LocalFact tests cannot run in CI environment");
21+
return new XunitTestCase(
22+
_diagnosticMessageSink,
23+
discoveryOptions.MethodDisplayOrDefault(),
24+
discoveryOptions.MethodDisplayOptionsOrDefault(),
25+
testMethod);
2926
}
27+
28+
return new ExecutionErrorTestCase(
29+
_diagnosticMessageSink,
30+
discoveryOptions.MethodDisplayOrDefault(),
31+
discoveryOptions.MethodDisplayOptionsOrDefault(),
32+
testMethod,
33+
"LocalFact tests cannot run in CI environment");
3034
}
3135
}

src/CookieCrumble/src/CookieCrumble/Snapshot.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ public class Snapshot
3131
new HttpResponseSnapshotValueFormatter(),
3232
new OperationResultSnapshotValueFormatter(),
3333
new JsonElementSnapshotValueFormatter(),
34-
#if NET7_0_OR_GREATER
34+
#if NET8_0_OR_GREATER
3535
new QueryPlanSnapshotValueFormatter(),
36-
new SkimmedSchemaSnapshotValueFormatter(),
3736
#endif
3837
});
3938
private static readonly JsonSnapshotValueFormatter _defaultFormatter = new();

src/HotChocolate/Core/src/Abstractions/HotChocolate.Abstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
<ItemGroup>
25-
<ProjectReference Include="..\..\..\Language\src\Language\HotChocolate.Language.csproj" />
25+
<ProjectReference Include="..\..\..\Primitives\src\Primitives\HotChocolate.Primitives.csproj" />
2626
</ItemGroup>
2727

2828
<ItemGroup>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System.Collections;
2+
using System.Diagnostics.CodeAnalysis;
3+
4+
namespace HotChocolate.Features;
5+
6+
public sealed class EmptyFeatureCollection : IFeatureCollection
7+
{
8+
private EmptyFeatureCollection()
9+
{
10+
}
11+
12+
public bool IsReadOnly => true;
13+
14+
public int Revision => 0;
15+
16+
public object? this[Type key]
17+
{
18+
get => default;
19+
set => ThrowReadOnly();
20+
}
21+
22+
/// <inheritdoc />
23+
public TFeature? Get<TFeature>()
24+
=> default;
25+
26+
/// <inheritdoc />
27+
public void Set<TFeature>(TFeature? instance)
28+
=> ThrowReadOnly();
29+
30+
[DoesNotReturn]
31+
private static void ThrowReadOnly()
32+
=> throw new NotSupportedException("The feature collection is read-only.");
33+
34+
/// <inheritdoc />
35+
public IEnumerator<KeyValuePair<Type, object>> GetEnumerator()
36+
{
37+
yield break;
38+
}
39+
40+
/// <inheritdoc />
41+
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
42+
43+
public static EmptyFeatureCollection Default { get; } = new();
44+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This code was originally forked of https://github.com/dotnet/aspnetcore/tree/c7aae8ff34dce81132d0fb3a976349dcc01ff903/src/Extensions/Features/src
2+
3+
namespace HotChocolate.Features;
4+
5+
/// <summary>
6+
/// An object that has features.
7+
/// </summary>
8+
public interface IFeatureProvider
9+
{
10+
/// <summary>
11+
/// Gets the feature collection.
12+
/// </summary>
13+
IFeatureCollection Features { get; }
14+
}

src/HotChocolate/Core/src/Features/ReadOnlyFeatureCollection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public object? this[Type key]
6666
}
6767

6868
/// <inheritdoc />
69-
public void Set<TFeature>(TFeature? instance) =>
70-
throw new NotSupportedException("The feature collection is read-only.");
69+
public void Set<TFeature>(TFeature? instance)
70+
=> throw new NotSupportedException("The feature collection is read-only.");
7171

7272
/// <inheritdoc />
7373
public IEnumerator<KeyValuePair<Type, object>> GetEnumerator() => _features.GetEnumerator();

0 commit comments

Comments
 (0)