Skip to content

Commit 178f997

Browse files
authored
Merge pull request #123
Add support for predefined enum.
2 parents 380d274 + 14d38a5 commit 178f997

18 files changed

+70
-12
lines changed

src/TestApp/TestStandardLibrary/Generated/GraphQL.g.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// c849b892619845face64d0012af70905
1+
// 6ed7879f132707962e54dd34977ad956
22
// <auto-generated>
33
// This file generated for ZeroQL 1.0.0.0.
44
//
@@ -15,6 +15,7 @@ namespace GraphQL.TestServer
1515
using System.Text.Json;
1616
using ZeroQL;
1717
using ZeroQL.Json;
18+
using ZeroQL.Internal;
1819

1920
public class TestServerClient : global::ZeroQL.GraphQLClient<Query, Mutation>
2021
{
@@ -1140,6 +1141,10 @@ public class User
11401141
[JsonPropertyName("userKind")]
11411142
public UserKind UserKind { get; set; }
11421143

1144+
[ZeroQL.GraphQLName("kind")]
1145+
[JsonPropertyName("kind")]
1146+
public __TypeKind Kind { get; set; }
1147+
11431148
[JsonPropertyName("role")]
11441149
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
11451150
[global::System.ObsoleteAttribute("This property is for internal use only. Do not use it directly. It maybe be removed in the future releases.")]

src/TestApp/ZeroQL.TestApp/Generated/GraphQL.g.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// 2529ecfad66562aa7d1aa2a47edf3d08
1+
// eba44a7905e80c72dd75a1a8467f4216
22
// <auto-generated>
33
// This file generated for ZeroQL 1.0.0.0.
44
//
@@ -15,6 +15,7 @@ namespace GraphQL.TestServer
1515
using System.Text.Json;
1616
using ZeroQL;
1717
using ZeroQL.Json;
18+
using ZeroQL.Internal;
1819

1920
public class TestServerClient : global::ZeroQL.GraphQLClient<Query, Mutation>
2021
{
@@ -1140,6 +1141,10 @@ public class User
11401141
[JsonPropertyName("userKind")]
11411142
public UserKind UserKind { get; set; }
11421143

1144+
[ZeroQL.GraphQLName("kind")]
1145+
[JsonPropertyName("kind")]
1146+
public __TypeKind Kind { get; set; }
1147+
11431148
[JsonPropertyName("role")]
11441149
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
11451150
[global::System.ObsoleteAttribute("This property is for internal use only. Do not use it directly. It maybe be removed in the future releases.")]

src/TestApp/ZeroQL.TestApp/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ type User {
210210
firstName: String!
211211
lastName: String!
212212
userKind: UserKind!
213+
kind: __TypeKind!
213214
role: Role
214215
loginAttempts: [UserLoginAttempt!]!
215216
}

src/ZeroQL.Runtime/GraphQL/GraphQL.cs

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

33
using System;
44

5+
// ReSharper disable once CheckNamespace
56
namespace ZeroQL;
67

78
[Obsolete("Request syntax is deprecated because it is not compatible with AOT runtimes. It will be removed in the future releases.")]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// ReSharper disable InconsistentNaming
2+
// ReSharper disable once CheckNamespace
3+
4+
namespace ZeroQL.Internal;
5+
6+
// ReSharper disable once UnusedMember.Global
7+
public enum __TypeKind
8+
{
9+
Interface = 0,
10+
Object = 1,
11+
Union = 2,
12+
InputObject = 4,
13+
Enum = 8,
14+
Scalar = 16, // 0x00000010
15+
List = 32, // 0x00000020
16+
NonNull = 64, // 0x00000040
17+
Directive = 128, // 0x00000080
18+
}

src/ZeroQL.TestServer/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ public class Program
1414

1515
public static async Task Main(string[] args)
1616
{
17-
await StartServer(new ServerContext
17+
var (_, task) = await StartServer(new ServerContext
1818
{
1919
Arguments = args,
2020
Port = 10_000,
2121
});
22+
23+
await task;
2224
}
2325

24-
public static async Task<WebApplication> StartServer(ServerContext context)
26+
public static async Task<(WebApplication App, Task Running)> StartServer(ServerContext context)
2527
{
2628
var builder = WebApplication.CreateBuilder(context.Arguments);
2729
var app = CreateApp(context, builder);
2830

29-
_ = app.RunAsync(context.CancellationTokenSource.Token);
31+
var runningTask = app.RunAsync(context.CancellationTokenSource.Token);
3032

31-
return app;
33+
return (app, runningTask);
3234
}
3335

3436
public static WebApplication CreateApp(ServerContext context, WebApplicationBuilder builder)

src/ZeroQL.TestServer/Query/Models/Limit.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace ZeroQL.TestServer.Query.Models;
1+
// ReSharper disable InconsistentNaming
2+
namespace ZeroQL.TestServer.Query.Models;
23

34
[GraphQLName("Limit")]
45
public class Limit_1

src/ZeroQL.TestServer/Query/Models/User.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public class User
1010
public string LastName { get; set; }
1111

1212
public UserKind UserKind { get; set; }
13+
14+
public TypeKind Kind { get; set; } = TypeKind.Object;
1315

1416
public static User Create() => new User()
1517
{

src/ZeroQL.Tests/Bootstrap/CustomSchemaParseTests.ClassNameIdenticalToPropertyName.verified.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace TestApp
1515
using System.Text.Json;
1616
using ZeroQL;
1717
using ZeroQL.Json;
18+
using ZeroQL.Internal;
1819

1920
public class GraphQLClient : global::ZeroQL.GraphQLClient<Query, ZeroQL.Unit>
2021
{

src/ZeroQL.Tests/Bootstrap/ParseSchemaTests.InternalClient.verified.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace GraphQLClient
1515
using System.Text.Json;
1616
using ZeroQL;
1717
using ZeroQL.Json;
18+
using ZeroQL.Internal;
1819

1920
internal class TestApp : global::ZeroQL.GraphQLClient<Query, Mutation>
2021
{
@@ -1140,6 +1141,10 @@ namespace GraphQLClient
11401141
[JsonPropertyName("userKind")]
11411142
public UserKind UserKind { get; set; }
11421143

1144+
[ZeroQL.GraphQLName("kind")]
1145+
[JsonPropertyName("kind")]
1146+
public __TypeKind Kind { get; set; }
1147+
11431148
[JsonPropertyName("role")]
11441149
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
11451150
[global::System.ObsoleteAttribute("This property is for internal use only. Do not use it directly. It maybe be removed in the future releases.")]

0 commit comments

Comments
 (0)