From c4384cfc7bc429df32aa4cae4ef646d7c1800fe2 Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Mon, 11 Nov 2024 16:41:35 +0100 Subject: [PATCH 1/2] Prevent error after hot reload: Operation is not valid due to the current state of the object. (DateTimeType) Stumbled upon this solution here: https://github.com/ChilliCream/graphql-platform/pull/2985#issuecomment-772084224 --- backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs b/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs index abd27c078..ebeccae1d 100644 --- a/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs +++ b/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs @@ -50,10 +50,10 @@ public static void AddLexGraphQL(this IServiceCollection services, IHostEnvironm options.IncludeExceptionDetails = true; }) .AddType() - .AddType(new DateTimeType("DateTime")) - .AddType(new UuidType("UUID")) - .AddType(new DateTimeType("timestamptz")) - .AddType(new UuidType("uuid")) + .AddType(() => new DateTimeType("DateTime")) + .AddType(() => new UuidType("UUID")) + .AddType(() => new DateTimeType("timestamptz")) + .AddType(() => new UuidType("uuid")) .AddInstrumentation(options => { options.IncludeDocument = true; From e63f8fd6ae0856b29ec6cef8dfc3330377981b2c Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 12 Nov 2024 10:08:23 +0700 Subject: [PATCH 2/2] remove manually added graphql types which are automatically defined --- backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs | 4 ---- frontend/schema.graphql | 7 ++----- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs b/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs index ebeccae1d..97d7585a0 100644 --- a/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs +++ b/backend/LexBoxApi/GraphQL/GraphQlSetupKernel.cs @@ -50,10 +50,6 @@ public static void AddLexGraphQL(this IServiceCollection services, IHostEnvironm options.IncludeExceptionDetails = true; }) .AddType() - .AddType(() => new DateTimeType("DateTime")) - .AddType(() => new UuidType("UUID")) - .AddType(() => new DateTimeType("timestamptz")) - .AddType(() => new UuidType("uuid")) .AddInstrumentation(options => { options.IncludeDocument = true; diff --git a/frontend/schema.graphql b/frontend/schema.graphql index 06060b836..66620c933 100644 --- a/frontend/schema.graphql +++ b/frontend/schema.graphql @@ -1248,13 +1248,10 @@ directive @listSize("The `assumedSize` argument can be used to statically define "The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions." directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR +"The `DateTime` scalar represents an ISO-8601 compliant date time type." scalar DateTime @specifiedBy(url: "https:\/\/www.graphql-scalars.com\/date-time") "The `Long` scalar type represents non-fractional signed whole 64-bit numeric values. Long can represent values between -(2^63) and 2^63 - 1." scalar Long -scalar UUID - -scalar timestamptz @specifiedBy(url: "https:\/\/www.graphql-scalars.com\/date-time") - -scalar uuid \ No newline at end of file +scalar UUID @specifiedBy(url: "https:\/\/tools.ietf.org\/html\/rfc4122") \ No newline at end of file