File tree Expand file tree Collapse file tree 5 files changed +36
-8
lines changed
src/HotChocolate/Utilities/src
Utilities.DependencyInjection Expand file tree Collapse file tree 5 files changed +36
-8
lines changed Original file line number Diff line number Diff line change 77 <Description >Contains internal helper classes for Microsoft's dependency injection used by the Hot Chocolate GraphQL type system and the GraphQL query execution engine.</Description >
88 </PropertyGroup >
99
10+ <PropertyGroup >
11+ <IsAotCompliant >true</IsAotCompliant >
12+ </PropertyGroup >
13+
1014 <ItemGroup >
1115 <InternalsVisibleTo Include =" HotChocolate.AspNetCore" />
1216 <InternalsVisibleTo Include =" HotChocolate.Execution" />
Original file line number Diff line number Diff line change 77 <Description >Contains an introspection client to download a GraphQL schema over HTTP.</Description >
88 </PropertyGroup >
99
10+ <PropertyGroup >
11+ <IsAotCompliant >true</IsAotCompliant >
12+ </PropertyGroup >
13+
1014 <ItemGroup >
1115 <InternalsVisibleTo Include =" HotChocolate.Utilities.Introspection.Tests" />
1216 </ItemGroup >
Original file line number Diff line number Diff line change 11using System . Text ;
22using System . Text . Json ;
3- using System . Text . Json . Serialization ;
43using HotChocolate . Language ;
54using HotChocolate . Transport . Http ;
65using static HotChocolate . Utilities . Introspection . CapabilityInspector ;
@@ -13,11 +12,8 @@ namespace HotChocolate.Utilities.Introspection;
1312/// </summary>
1413public static class IntrospectionClient
1514{
16- private static readonly JsonSerializerOptions s_serializerOptions = new ( )
17- {
18- PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
19- Converters = { new JsonStringEnumConverter ( ) }
20- } ;
15+ private static readonly JsonSerializerOptions s_serializerOptions =
16+ new ( IntrospectionJsonSerializerContext . Default . Options ) ;
2117
2218 internal static JsonSerializerOptions SerializerOptions => s_serializerOptions ;
2319
@@ -245,12 +241,12 @@ private static async Task<IntrospectionResult> IntrospectAsync(
245241
246242 if ( result . Data . ValueKind is JsonValueKind . Object )
247243 {
248- data = result . Data . Deserialize < IntrospectionData > ( s_serializerOptions ) ;
244+ data = result . Data . Deserialize ( IntrospectionJsonSerializerContext . Default . IntrospectionData ) ;
249245 }
250246
251247 if ( result . Errors . ValueKind is JsonValueKind . Array )
252248 {
253- errors = result . Errors . Deserialize < IntrospectionError [ ] > ( s_serializerOptions ) ;
249+ errors = result . Errors . Deserialize ( IntrospectionJsonSerializerContext . Default . IntrospectionErrorArray ) ;
254250 }
255251
256252 return new IntrospectionResult ( data , errors ) ;
Original file line number Diff line number Diff line change 1+ using System . Text . Json . Serialization ;
2+
3+ namespace HotChocolate . Utilities . Introspection ;
4+
5+ [ JsonSourceGenerationOptions (
6+ PropertyNamingPolicy = JsonKnownNamingPolicy . CamelCase ,
7+ DefaultIgnoreCondition = JsonIgnoreCondition . Never ) ]
8+ [ JsonSerializable ( typeof ( IntrospectionResult ) ) ]
9+ [ JsonSerializable ( typeof ( IntrospectionData ) ) ]
10+ [ JsonSerializable ( typeof ( IntrospectionError ) ) ]
11+ [ JsonSerializable ( typeof ( IntrospectionError [ ] ) ) ]
12+ [ JsonSerializable ( typeof ( Schema ) ) ]
13+ [ JsonSerializable ( typeof ( FullType ) ) ]
14+ [ JsonSerializable ( typeof ( Field ) ) ]
15+ [ JsonSerializable ( typeof ( InputField ) ) ]
16+ [ JsonSerializable ( typeof ( Directive ) ) ]
17+ [ JsonSerializable ( typeof ( TypeRef ) ) ]
18+ [ JsonSerializable ( typeof ( RootTypeRef ) ) ]
19+ [ JsonSerializable ( typeof ( EnumValue ) ) ]
20+ [ JsonSerializable ( typeof ( TypeKind ) ) ]
21+ internal sealed partial class IntrospectionJsonSerializerContext : JsonSerializerContext ;
Original file line number Diff line number Diff line change 11#nullable disable
22
3+ using System . Text . Json . Serialization ;
4+
35namespace HotChocolate . Utilities . Introspection ;
46
7+ [ JsonConverter ( typeof ( JsonStringEnumConverter < TypeKind > ) ) ]
58public enum TypeKind
69{
710 INTERFACE = 0 ,
You can’t perform that action at this time.
0 commit comments