diff --git a/.gitignore b/.gitignore
index 0ca0c13..1c1ff5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -240,3 +240,4 @@ ModelManifest.xml
# FAKE - F# Make
.fake/
+**/.DS_Store
diff --git a/src/GraphQLinq.Demo/Demo.csproj b/src/GraphQLinq.Demo/Demo.csproj
index 6d84151..2b6ae33 100644
--- a/src/GraphQLinq.Demo/Demo.csproj
+++ b/src/GraphQLinq.Demo/Demo.csproj
@@ -3,6 +3,9 @@
net6
Exe
+
+ GraphQLinq.Demo
+
diff --git a/src/GraphQLinq.Scaffolding/Program.cs b/src/GraphQLinq.Scaffolding/Program.cs
index 4a16f83..dbf7ee9 100644
--- a/src/GraphQLinq.Scaffolding/Program.cs
+++ b/src/GraphQLinq.Scaffolding/Program.cs
@@ -5,7 +5,11 @@
using System.Net.Http;
using System.Net.Http.Json;
using System.Text.Json;
+using System.Text.Json.Serialization;
using System.Threading.Tasks;
+using GraphQL;
+using GraphQL.Client.Http;
+using GraphQL.Client.Serializer.SystemTextJson;
using Spectre.Console;
namespace GraphQLinq.Scaffolding
@@ -135,15 +139,28 @@ private static async Task HandleGenerate(Uri endpoint, string output, string @na
AnsiConsole.MarkupLine("Scaffolding GraphQL client code for [bold]{0}[/] to [bold]{1}[/]", endpoint, outputFolder);
- var schema = await AnsiConsole.Status().StartAsync("Performing introspection", async ctx =>
+ var data = await AnsiConsole.Status().StartAsync("Performing introspection", async ctx =>
{
- AnsiConsole.WriteLine("Running introspection query ...");
- using var httpClient = new HttpClient();
- using var responseMessage = await httpClient.PostAsJsonAsync(endpoint, new { query = IntrospectionQuery });
+ try
+ {
+
+ AnsiConsole.WriteLine("Running introspection query ...");
+ GraphQLHttpClient client = new GraphQLHttpClient(endpoint, new SystemTextJsonSerializer());
+ var request = new GraphQLRequest
+ {
+ Query = IntrospectionQuery
+ };
+ var responseMessage = await client.SendQueryAsync(request);
- AnsiConsole.WriteLine("Reading and deserializing schema information ...");
- var schemaJson = await responseMessage.Content.ReadAsStringAsync();
- return JsonSerializer.Deserialize(schemaJson, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+ AnsiConsole.WriteLine("Reading and deserializing schema information ...");
+ return responseMessage.Data;
+ //var schemaJson = await responseMessage;
+ //return JsonSerializer.Deserialize(schemaJson, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
});
AnsiConsole.WriteLine();
@@ -158,7 +175,7 @@ private static async Task HandleGenerate(Uri endpoint, string output, string @na
};
var graphQLClassesGenerator = new GraphQLClassesGenerator(codeGenerationOptions);
- return graphQLClassesGenerator.GenerateClient(schema.Data.Schema, endpoint.AbsoluteUri);
+ return graphQLClassesGenerator.GenerateClient(data.Schema, endpoint.AbsoluteUri);
});
AnsiConsole.WriteLine();
diff --git a/src/GraphQLinq.Scaffolding/RootSchemaObject.cs b/src/GraphQLinq.Scaffolding/RootSchemaObject.cs
index 16b156d..4ebcbbf 100644
--- a/src/GraphQLinq.Scaffolding/RootSchemaObject.cs
+++ b/src/GraphQLinq.Scaffolding/RootSchemaObject.cs
@@ -36,13 +36,19 @@ public class GraphqlType : BaseInfo
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
public enum TypeKind
{
+ [EnumMember(Value = "LIST")]
List,
[EnumMember(Value = "NON_NULL")]
NonNull,
+ [EnumMember(Value = "SCALAR")]
Scalar,
+ [EnumMember(Value = "OBJECT")]
Object,
+ [EnumMember(Value = "INTERFACE")]
Interface,
+ [EnumMember(Value = "UNION")]
Union,
+ [EnumMember(Value = "ENUM")]
Enum,
[EnumMember(Value = "INPUT_OBJECT")]
InputObject
diff --git a/src/GraphQLinq.Scaffolding/Scaffolding.csproj b/src/GraphQLinq.Scaffolding/Scaffolding.csproj
index 0243803..e421228 100644
--- a/src/GraphQLinq.Scaffolding/Scaffolding.csproj
+++ b/src/GraphQLinq.Scaffolding/Scaffolding.csproj
@@ -1,6 +1,6 @@
- net6
+ net7
Exe
enable
@@ -31,6 +31,10 @@
Generate classes from GraphQL endpoint and write strongly typed queries with LINQ.
GraphQLinq.Scaffolding
+
+ 4
+ GraphQLinq.Scaffolding
+
@@ -38,6 +42,13 @@
+
+
+
+
+
+
+
diff --git a/src/GraphQLinq.TestServer/Properties/launchSettings.json b/src/GraphQLinq.TestServer/Properties/launchSettings.json
index dab3581..d8690b1 100644
--- a/src/GraphQLinq.TestServer/Properties/launchSettings.json
+++ b/src/GraphQLinq.TestServer/Properties/launchSettings.json
@@ -1,11 +1,10 @@
-{
+{
"profiles": {
"GraphQLing.TestServer": {
"commandName": "Project",
- "dotnetRunMessages": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/GraphQLinq.TestServer/TestServer.csproj b/src/GraphQLinq.TestServer/TestServer.csproj
index 44fd198..e2cc575 100644
--- a/src/GraphQLinq.TestServer/TestServer.csproj
+++ b/src/GraphQLinq.TestServer/TestServer.csproj
@@ -6,6 +6,7 @@
enable
+