diff --git a/src/AspNetCore/Example/Example.csproj b/src/AspNetCore/Example/Example.csproj index d7648c4..e32ec9b 100644 --- a/src/AspNetCore/Example/Example.csproj +++ b/src/AspNetCore/Example/Example.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/AspNetCore/Example/Startup.cs b/src/AspNetCore/Example/Startup.cs index 587594e..0fccedf 100644 --- a/src/AspNetCore/Example/Startup.cs +++ b/src/AspNetCore/Example/Startup.cs @@ -26,11 +26,12 @@ public void ConfigureServices(IServiceCollection services) services.AddLogging(builder => builder.AddConsole()); services.AddHttpContextAccessor(); - services.AddGraphQL(_ => + services.AddGraphQL(options => { - _.EnableMetrics = true; - _.ExposeExceptions = true; + options.EnableMetrics = true; + options.ExposeExceptions = true; }) + .AddNewtonsoftJson() // or use AddSystemTextJson for .NET Core 3+ .AddUserContextBuilder(httpContext => new GraphQLUserContext { User = httpContext.User }); } diff --git a/src/AspNetCoreCustom/Example/Example.csproj b/src/AspNetCoreCustom/Example/Example.csproj index 5b2f5a6..c7a905b 100644 --- a/src/AspNetCoreCustom/Example/Example.csproj +++ b/src/AspNetCoreCustom/Example/Example.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.2 @@ -7,6 +7,7 @@ + diff --git a/src/AspNetCoreCustom/Example/GraphQLMiddleware.cs b/src/AspNetCoreCustom/Example/GraphQLMiddleware.cs index 5542e4b..36c65a9 100644 --- a/src/AspNetCoreCustom/Example/GraphQLMiddleware.cs +++ b/src/AspNetCoreCustom/Example/GraphQLMiddleware.cs @@ -1,6 +1,6 @@ using GraphQL; -using GraphQL.Http; using GraphQL.Instrumentation; +using GraphQL.NewtonsoftJson; using GraphQL.Types; using GraphQL.Validation; using Microsoft.AspNetCore.Http; diff --git a/src/AspNetCoreCustom/Example/Startup.cs b/src/AspNetCoreCustom/Example/Startup.cs index aa79ea3..a609748 100644 --- a/src/AspNetCoreCustom/Example/Startup.cs +++ b/src/AspNetCoreCustom/Example/Startup.cs @@ -1,5 +1,4 @@ using GraphQL; -using GraphQL.Http; using GraphQL.Types; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -15,7 +14,7 @@ public class Startup public void ConfigureServices(IServiceCollection services) { services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/src/AspNetWebApi/WebApi/Bootstrapper.cs b/src/AspNetWebApi/WebApi/Bootstrapper.cs index 33af37a..9902718 100644 --- a/src/AspNetWebApi/WebApi/Bootstrapper.cs +++ b/src/AspNetWebApi/WebApi/Bootstrapper.cs @@ -1,5 +1,4 @@ using GraphQL; -using GraphQL.Http; using GraphQL.Types; using IoC; using StarWars; @@ -20,7 +19,7 @@ private ISimpleContainer BuildContainer() { var container = new SimpleContainer(); container.Singleton(new DocumentExecuter()); - container.Singleton(new DocumentWriter(true)); + container.Singleton(new GraphQL.NewtonsoftJson.DocumentWriter(true)); container.Singleton(new StarWarsData()); container.Register(); diff --git a/src/AspNetWebApi/WebApi/Controllers/GraphQLController.cs b/src/AspNetWebApi/WebApi/Controllers/GraphQLController.cs index b92a691..521619d 100644 --- a/src/AspNetWebApi/WebApi/Controllers/GraphQLController.cs +++ b/src/AspNetWebApi/WebApi/Controllers/GraphQLController.cs @@ -1,5 +1,5 @@ -using GraphQL.Http; using GraphQL.Instrumentation; +using GraphQL.NewtonsoftJson; using GraphQL.Types; using GraphQL.Validation.Complexity; using System.Net; diff --git a/src/AspNetWebApi/WebApi/Web.config b/src/AspNetWebApi/WebApi/Web.config index 032e30e..70659d2 100644 --- a/src/AspNetWebApi/WebApi/Web.config +++ b/src/AspNetWebApi/WebApi/Web.config @@ -5,291 +5,271 @@ --> - - - - + + + + - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/AspNetWebApi/WebApi/WebApi.csproj b/src/AspNetWebApi/WebApi/WebApi.csproj index 283e43f..d1ee2c8 100644 --- a/src/AspNetWebApi/WebApi/WebApi.csproj +++ b/src/AspNetWebApi/WebApi/WebApi.csproj @@ -1,4 +1,4 @@ - + @@ -45,18 +45,21 @@ 4 - - ..\packages\GraphQL.3.0.0-preview-1357\lib\netstandard2.0\GraphQL.dll + + ..\packages\GraphQL.3.0.0-preview-1558\lib\netstandard2.0\GraphQL.dll - - ..\packages\GraphQL-Parser.4.2.0\lib\netstandard2.0\GraphQL-Parser.dll + + ..\packages\GraphQL-Parser.5.0.1\lib\netstandard2.0\GraphQL-Parser.dll + + + ..\packages\GraphQL.NewtonsoftJson.3.0.0-preview-1558\lib\netstandard2.0\GraphQL.NewtonsoftJson.dll ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll @@ -234,4 +237,4 @@ --> - + \ No newline at end of file diff --git a/src/AspNetWebApi/WebApi/packages.config b/src/AspNetWebApi/WebApi/packages.config index f3c5091..0a242f7 100644 --- a/src/AspNetWebApi/WebApi/packages.config +++ b/src/AspNetWebApi/WebApi/packages.config @@ -1,8 +1,9 @@  - - + + + @@ -15,7 +16,7 @@ - + diff --git a/src/AzureFunctions/Example/Example.csproj b/src/AzureFunctions/Example/Example.csproj index dc5da09..4edd705 100644 --- a/src/AzureFunctions/Example/Example.csproj +++ b/src/AzureFunctions/Example/Example.csproj @@ -5,7 +5,8 @@ enable - + + diff --git a/src/AzureFunctions/Example/GraphQLExecuterExtensions.cs b/src/AzureFunctions/Example/GraphQLExecuterExtensions.cs index 2259ae7..2c2d9a6 100644 --- a/src/AzureFunctions/Example/GraphQLExecuterExtensions.cs +++ b/src/AzureFunctions/Example/GraphQLExecuterExtensions.cs @@ -3,6 +3,7 @@ // // https://github.com/tpeczek using GraphQL; +using GraphQL.NewtonsoftJson; using GraphQL.Server.Internal; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; @@ -49,7 +50,7 @@ public async static Task ExecuteAsync(this IGraphQLExecuter gra break; case GRAPHQL_MEDIA_TYPE: query = await ExtractGraphQLQueryFromGraphQLBodyAsync(request.Body); - variables = new Inputs(); + variables = Inputs.Empty; break; case FORM_URLENCODED_MEDIA_TYPE: (operationName, query, variables) = await ExtractGraphQLAttributesFromFormCollectionAsync(request); @@ -77,7 +78,7 @@ private static (string? operationName, string query, Inputs variables) ExtractGr return ( request.Query.TryGetValue(OPERATION_NAME_KEY, out var operationNameValues) ? operationNameValues[0] : null, request.Query[QUERY_KEY][0], - request.Query.TryGetValue(VARIABLES_KEY, out var variablesValues) ? variablesValues[0].ToInputs() : new Inputs() + request.Query.TryGetValue(VARIABLES_KEY, out var variablesValues) ? variablesValues[0].ToInputs() : Inputs.Empty ); } diff --git a/src/AzureFunctions/Example/GraphQLExecutionResult.cs b/src/AzureFunctions/Example/GraphQLExecutionResult.cs index 91b67db..73f59fb 100644 --- a/src/AzureFunctions/Example/GraphQLExecutionResult.cs +++ b/src/AzureFunctions/Example/GraphQLExecutionResult.cs @@ -3,7 +3,6 @@ // // https://github.com/tpeczek using GraphQL; -using GraphQL.Http; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; diff --git a/src/AzureFunctions/nuget.config b/src/AzureFunctions/nuget.config new file mode 100644 index 0000000..2c0eb01 --- /dev/null +++ b/src/AzureFunctions/nuget.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/StarWars/StarWars.csproj b/src/StarWars/StarWars.csproj index d9581d7..2353ebd 100644 --- a/src/StarWars/StarWars.csproj +++ b/src/StarWars/StarWars.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/StarWars/StarWarsMutation.cs b/src/StarWars/StarWarsMutation.cs index 80a1bc6..8c15653 100644 --- a/src/StarWars/StarWarsMutation.cs +++ b/src/StarWars/StarWarsMutation.cs @@ -1,3 +1,4 @@ +using GraphQL; using GraphQL.Types; using StarWars.Types; diff --git a/src/StarWars/StarWarsQuery.cs b/src/StarWars/StarWarsQuery.cs index 112568c..c5b81ec 100644 --- a/src/StarWars/StarWarsQuery.cs +++ b/src/StarWars/StarWarsQuery.cs @@ -1,4 +1,5 @@ using System; +using GraphQL; using GraphQL.Types; using StarWars.Types; @@ -19,7 +20,7 @@ public StarWarsQuery(StarWarsData data) resolve: context => data.GetHumanByIdAsync(context.GetArgument("id")) ); - Func func = (context, id) => data.GetDroidByIdAsync(id); + Func func = (context, id) => data.GetDroidByIdAsync(id); FieldDelegate( "droid",