Skip to content

Commit da4d951

Browse files
Copilotxperiandri
andcommitted
Remove unnecessary SchemaId helper module
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/345ce2da-408c-4257-81ba-49eeac04c122 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent 66bc73b commit da4d951

3 files changed

Lines changed: 2 additions & 14 deletions

File tree

src/FSharp.Data.GraphQL.Client.DesignTime/ProvidedTypesHelper.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ module internal Provider =
799799
match validationResult with
800800
| ValidationError msgs -> failwith (formatValidationExceptionMessage msgs)
801801
| Success -> ()
802-
let key = { DocumentId = DocumentId.fromCanonicalQuery (queryAst.ToQueryString()); SchemaId = SchemaId.fromIntrospectionSchema schema }
802+
let key = { DocumentId = DocumentId.fromCanonicalQuery (queryAst.ToQueryString()); SchemaId = schema.GetHashCode() }
803803
let refMaker = lazy Validation.Ast.validateDocument schema queryAst
804804
if clientQueryValidation then
805805
refMaker.Force

src/FSharp.Data.GraphQL.Server/Executor.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ type Executor<'Root>(schema: ISchema<'Root>, middlewares : IExecutorMiddleware s
102102
| ValidationError errors -> raise (GQLMessageException (System.String.Join("\n", errors)))
103103

104104
// Compute schema ID once after middleware has run and cache it for the lifetime of this Executor instance
105-
let schemaId = SchemaId.fromIntrospectionSchema schema.Introspected
105+
let schemaId = schema.Introspected.GetHashCode()
106106

107107
let eval (executionPlan: ExecutionPlan, data: 'Root option, variables: ImmutableDictionary<string, JsonElement>, getInputContext : InputExecutionContextProvider): Async<GQLExecutionResult> =
108108
let documentId = executionPlan.DocumentId

src/FSharp.Data.GraphQL.Shared/ValidationResultCache.fs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace FSharp.Data.GraphQL.Validation
22

33
open FSharp.Data.GraphQL
4-
open FSharp.Data.GraphQL.Types.Introspection
54
open System
65

76
type ValidationResultKey =
@@ -14,17 +13,6 @@ type ValidationResultProducer =
1413
type IValidationResultCache =
1514
abstract GetOrAdd : ValidationResultProducer -> ValidationResultKey -> ValidationResult<GQLProblemDetails>
1615

17-
module SchemaId =
18-
/// <summary>
19-
/// Computes an in-memory schema identifier from an introspection schema instance.
20-
/// This identifier is valid only within the current process/runtime and is not deterministic across process restarts.
21-
/// </summary>
22-
/// <param name="introspectionSchema">The introspection schema.</param>
23-
/// <returns>The schema hash code for in-process cache keys.</returns>
24-
[<CompiledName("FromIntrospectionSchema")>]
25-
let fromIntrospectionSchema (introspectionSchema : IntrospectionSchema) =
26-
introspectionSchema.GetHashCode()
27-
2816
/// An in-memory cache for the results of schema/document validations, with a lifetime of 30 seconds.
2917
type MemoryValidationResultCache () =
3018
let expirationPolicy = CacheExpirationPolicy.SlidingExpiration(TimeSpan.FromSeconds 30.0)

0 commit comments

Comments
 (0)