Skip to content

Commit 9a82472

Browse files
Copilotxperiandri
andauthored
Fix schema ID computation to run after middleware compilation
Agent-Logs-Url: https://github.com/fsprojects/FSharp.Data.GraphQL/sessions/38a5449a-9904-46f6-b33a-acf9f32a7151 Co-authored-by: xperiandri <2365592+xperiandri@users.noreply.github.com>
1 parent 7805e83 commit 9a82472

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ type ExecutorMiddleware(?compile, ?postCompile, ?plan, ?execute) =
6666
/// An optional pre-existing validation cache can be supplied. If not, one is created and used internally.
6767
type Executor<'Root>(schema: ISchema<'Root>, middlewares : IExecutorMiddleware seq, [<Optional>] validationCache : IValidationResultCache voption) =
6868
let validationCache = validationCache |> ValueOption.defaultWith (fun () -> upcast MemoryValidationResultCache())
69-
70-
// Compute schema ID once and cache it for the lifetime of this Executor instance
71-
let schemaId = SchemaId.fromIntrospectionSchema schema.Introspected
7269

7370
let fieldExecuteMap = FieldExecuteMap(compileField)
7471

@@ -103,6 +100,9 @@ type Executor<'Root>(schema: ISchema<'Root>, middlewares : IExecutorMiddleware s
103100
match Validation.Types.validateTypeMap schema.TypeMap with
104101
| Success -> ()
105102
| ValidationError errors -> raise (GQLMessageException (System.String.Join("\n", errors)))
103+
104+
// 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
106106

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

0 commit comments

Comments
 (0)