Skip to content

Commit cebc93d

Browse files
authored
Adds composite schema directives to HotChocolate.Types. (#8468)
1 parent 94a45c2 commit cebc93d

File tree

67 files changed

+3004
-2133
lines changed

Some content is hidden

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

67 files changed

+3004
-2133
lines changed

src/HotChocolate/ApolloFederation/src/MSBuild/HotChocolate.ApolloFederation.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<PropertyGroup>
33
<!--ApolloFederationImplicitUsings: default|disable|enable-->
44
<ApolloFederationImplicitUsings>default</ApolloFederationImplicitUsings>
5+
<HotChocolateCompositeImplicitUsings>disable</HotChocolateCompositeImplicitUsings>
56
</PropertyGroup>
67
</Project>

src/HotChocolate/AspNetCore/src/MSBuild/HotChocolate.AspNetCore.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<PropertyGroup>
33
<!--HotChocolateImplicitUsings: default|disable|enable-->
44
<HotChocolateImplicitUsings Condition="'$(HotChocolateImplicitUsings)' == ''">default</HotChocolateImplicitUsings>
5+
<HotChocolateCompositeImplicitUsings Condition="'$(HotChocolateCompositeImplicitUsings)' == ''">default</HotChocolateImplicitUsings>
56
</PropertyGroup>
67
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<Project>
22
<PropertyGroup>
33
<HotChocolateImplicitUsings Condition="'$(ImplicitUsings)' == 'enable' AND '$(HotChocolateImplicitUsings)' != 'disable'">enable</HotChocolateImplicitUsings>
4+
<HotChocolateCompositeImplicitUsings Condition="'$(ImplicitUsings)' == 'enable' AND '$(HotChocolateCompositeImplicitUsings)' != 'disable'">enable</HotChocolateCompositeImplicitUsings>
45
</PropertyGroup>
56

67
<ItemGroup Condition="'$(HotChocolateImplicitUsings)' == 'enable'">
78
<Using Include="HotChocolate" />
89
<Using Include="HotChocolate.Types" />
910
<Using Include="HotChocolate.Types.Relay" />
11+
<Using Include="HotChocolate.Types.Composite" Condition="'$(HotChocolateCompositeImplicitUsings)' == 'enable'"/>
1012
<Using Include="GreenDonut" />
1113
</ItemGroup>
1214
</Project>

src/HotChocolate/Caching/test/Caching.Tests/CacheControlDirectiveTypeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void CreateCacheControlDirective()
5151
Assert.IsType<StringType>(t.Type.ElementType());
5252
});
5353
Assert.Collection(
54-
directive.Locations.AsEnumerable(),
54+
DirectiveLocationUtils.AsEnumerable(directive.Locations),
5555
t => Assert.Equal(Types.DirectiveLocation.Object, t),
5656
t => Assert.Equal(Types.DirectiveLocation.FieldDefinition, t),
5757
t => Assert.Equal(Types.DirectiveLocation.Interface, t),

src/HotChocolate/Caching/test/Caching.Tests/SchemaTests.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,7 @@ enum CacheControlScope {
4848
"The `@cacheControl` directive may be provided for individual fields or entire object, interface or union types to provide caching hints to the executor."
4949
directive @cacheControl("The maximum amount of time this field's cached value is valid, in seconds." maxAge: Int "The maximum amount of time this field's cached value is valid in shared caches like CDNs, in seconds." sharedMaxAge: Int "If `true`, the field inherits the `maxAge` of its parent field." inheritMaxAge: Boolean "If `PRIVATE`, the field's value is specific to a single user. The default value is `PUBLIC`, which means the field's value is not tied to a single user." scope: CacheControlScope "The Vary HTTP response header describes the parts of the request message aside from the method and URL that influenced the content of the response it occurs in. Most often, this is used to create a cache key when content negotiation is in use." vary: [String]) on OBJECT | FIELD_DEFINITION | INTERFACE | UNION
5050
51-
"""
52-
The `@oneOf` directive is used within the type system definition language
53-
to indicate:
54-
55-
- an Input Object is a Oneof Input Object, or
56-
- an Object Type's Field is a Oneof Field.
57-
"""
51+
"The `@oneOf` directive is used within the type system definition language to indicate that an input object is a oneof input object."
5852
directive @oneOf on INPUT_OBJECT
5953
6054
"""

src/HotChocolate/Core/src/Execution/Processing/IncludeCondition.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Runtime.CompilerServices;
22
using HotChocolate.Language;
3+
using HotChocolate.Types;
34
using HotChocolate.Utilities;
45

56
namespace HotChocolate.Execution.Processing;

src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaDebugFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ directiveDefinition.Description is null
7575
: new StringValueNode(directiveDefinition.Description),
7676
directiveDefinition.IsRepeatable,
7777
directiveDefinition.Arguments.Select(Format).ToArray(),
78-
directiveDefinition.Locations.AsEnumerable().Select(Format).ToArray());
78+
DirectiveLocationUtils.AsEnumerable(directiveDefinition.Locations).Select(Format).ToArray());
7979

8080
public static FieldDefinitionNode Format(IOutputFieldDefinition field)
8181
{

src/HotChocolate/Core/src/Types.Abstractions/Types/Extensions/HotChocolateTypesAbstractionsDirectiveLocationExtensions.cs

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

src/HotChocolate/Core/src/Types/Configuration/TypeInitializer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private void DiscoverTypes()
131131
throw new SchemaException(errors);
132132
}
133133

134-
// lets tell the type interceptors what types we have initialized.
134+
// let's tell the type interceptors what types we have initialized.
135135
_interceptor.OnTypesInitialized();
136136
_interceptor.OnAfterDiscoverTypes();
137137
}
@@ -155,7 +155,7 @@ private void RegisterImplicitAbstractTypeDependencies()
155155
{
156156
var typeRef = interfaceType.TypeReference;
157157
((ObjectType)objectType.Type).Configuration!.Interfaces.Add(typeRef);
158-
objectType.Dependencies.Add(new(typeRef, Completed));
158+
objectType.Dependencies.Add(new TypeDependency(typeRef, Completed));
159159
}
160160
}
161161
}
@@ -169,7 +169,7 @@ private void RegisterImplicitAbstractTypeDependencies()
169169
{
170170
var typeRef = interfaceType.TypeReference;
171171
((InterfaceType)implementing.Type).Configuration!.Interfaces.Add(typeRef);
172-
implementing.Dependencies.Add(new(typeRef, Completed));
172+
implementing.Dependencies.Add(new TypeDependency(typeRef, Completed));
173173
}
174174
}
175175
}

src/HotChocolate/Core/src/Types/HotChocolate.Types.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
<ItemGroup>
6161
<ProjectReference Include="..\..\..\..\GreenDonut\src\GreenDonut\GreenDonut.csproj" />
62+
<ProjectReference Include="..\..\..\Fusion-vnext\src\Fusion.Language\HotChocolate.Fusion.Language.csproj" />
6263
<ProjectReference Include="..\..\..\Utilities\src\Utilities\HotChocolate.Utilities.csproj" />
6364
<ProjectReference Include="..\Abstractions\HotChocolate.Abstractions.csproj" />
6465
<ProjectReference Include="..\Features\HotChocolate.Features.csproj" />

0 commit comments

Comments
 (0)